密碼學筆記
  • Introduction
  • 數論相關
  • 大數轉換
  • Big Endian & small Endian
  • MD5
  • RSA
  • DSA
  • AES
  • SHA256
  • RIPEMD
  • ECDSA & ECDH
  • OpenSSL 實用指令
  • Crypto module
  • Byte Padding
Powered by GitBook
On this page
  • Argon2
  • Bcrypt
  • sjcl (By standford)
  • PyCrypto (python crypto module)
  • Web Crypto API

Was this helpful?

Crypto module

PreviousOpenSSL 實用指令NextByte Padding

Last updated 2 years ago

Was this helpful?

Argon2

Bcrypt

sjcl (By standford)

PyCrypto (python crypto module)

Web Crypto API

async function sha256(message) {
    const msgBuffer = new TextEncoder('utf-8').encode(message);                     // encode as UTF-8
    const hashBuffer = await crypto.subtle.digest('SHA-256', msgBuffer);            // hash the message
    const hashArray = Array.from(new Uint8Array(hashBuffer));                       // convert ArrayBuffer to Array
    const hashHex = hashArray.map(b => ('00' + b.toString(16)).slice(-2)).join(''); // convert bytes to hex string
    return hashHex;
}

sha256('abc').then(hash => console.log(hash));

(async function() {
    const hash = await sha256('abc');
}());
https://github.com/ranisalt/node-argon2
https://github.com/kelektiv/node.bcrypt.js
https://github.com/bitwiseshiftleft/sjcl/tree/3668e639bc78e910815f501d55458e968845edc2
https://pycryptodome.readthedocs.io/en/latest/src/introduction.html
https://www.w3.org/TR/WebCryptoAPI/#crypto-interface
https://developer.mozilla.org/en-US/docs/Web/API/Crypto
https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/digest