mas-encrypt
TypeScript icon, indicating that this package has built-in type declarations

1.0.3 • Public • Published

一个加密工具

  import { encode, decode } from "mas-encrypt";
  let str = encode([1,2,3], "8087", 1);
  console.log(str);
  str = decode(str, "8087", 1)
  console.log(str); //[ 1, 2, 3 ]
  str = decode("sdsdsd", "8087", 1) 
  console.log(str); //false
declare module 'mas-encrypt' {
  /**
   * 加密字符串
   * @param text 要加密的文本
   * @param key 秘钥
   * @param longMode 是否开启长模式,默认0不开启,1开启
   */
    export function encode(
    text: any,
    key: string,
    longMode: number
  ): string | object;
  /**
   * 加密字符串,解密失败返回false
   * @param text 要解密的文本
   * @param key 秘钥
   * @param longMode 是否开启长模式,默认0不开启,1开启
   */
  export function decode(
    text: string,
    key: string,
    longMode: number
  ): string | object | false;
  
  }

Readme

Keywords

Package Sidebar

Install

npm i mas-encrypt

Weekly Downloads

10

Version

1.0.3

License

ISC

Unpacked Size

148 kB

Total Files

7

Last publish

Collaborators

  • tingxi8087