https://github.com/brix/crypto-js
    https://www.npmjs.com/package/crypto-js
    crypto文档 https://cryptojs.gitbook.io/docs/

    1. npm install crypto-js
    2. import sha256 from 'crypto-js/sha256';
    3. import hmacSHA512 from 'crypto-js/hmac-sha512';
    4. import Base64 from 'crypto-js/enc-base64';
    5. const message, nonce, path, privateKey; // ...
    6. const hashDigest = sha256(nonce + message);
    7. const hmacDigest = Base64.stringify(hmacSHA512(path + hashDigest, privateKey));
    • crypto-js/md5
    • crypto-js/sha1
    • crypto-js/sha256
    • crypto-js/sha224
    • crypto-js/sha512
    • crypto-js/sha384
    • crypto-js/sha3
    • crypto-js/ripemd160

    密码,基本都是sha256(salt + password)存储在数据库,
    每次前端传 password过来,后端那算出来的哈希值和数据库的值进行对比验证