js transmission data encryption

One, js function encryption

  escape()和unescape();

  The escape () function encodes a string so that it can be read on all computers.

    Encrypt escape (string)

  The unescape () function can decode strings encoded with escape ().

    Decrypt  unescape (string)

 

Second, base64 encryption

(1)introduction

    Base64 is one of the most common encoding methods used to transmit 8-bit byte codes on the network. Base64 is a method for representing binary data based on 64 printable characters.

    https://en.wikipedia.org/wiki/Base64

(2) Commonly used js base64 encryption library

     https://www.npmjs.com/package/js-base64

    npm install --save js-base64

(3) Native js already supports base64 encryption and decryption

    Encrypt window.btoa (decodeData) Decrypt window.atob (encodeData)

 

Three, md5 encryption

  npm install js-md5

  https://www.npmjs.com/package/js-md5

 

Four, hash code encryption

  npm install hash

    Secure hash algorithm (Secure Hash Algorithm) is mainly used in digital signature standard (Digital Signature Standard DSS) which defines the Digital Signature Algorithm (Digital Signature Algorithm DSA). For messages less than 2 ^ 64 bits in length, SHA1 will generate a 160-bit message digest .

    When a message is received, this message digest can be used to verify the integrity of the data. During the transmission process, the data is likely to change, then this time will produce a different message digest. 

 

Guess you like

Origin www.cnblogs.com/tongshuangxiong/p/12698085.html