Hashing and encrypting library with no depedencies
npm install crypto-api





Calculates SHA256 hash from UTF string "message"
``javascript
import Sha256 from "crypto-api/src/hasher/sha256";
import {toHex} from "crypto-api/src/encoder/hex";
import {fromUtf} from "crypto-api/src/encoder/utf";
let hasher = new Sha256();
hasher.update(fromUtf('message'));
console.log(toHex(hasher.finalize()));
`
Calculates HMAC-MD5 from UTF string "message" with UTF key "key"
`javascript
import Md5 from "crypto-api/src/hasher/md5";
import Hmac from "crypto-api/src/mac/hmac";
import {toHex} from "crypto-api/src/encoder/hex";
import {fromUtf} from "crypto-api/src/encoder/utf";
let hasher = new Md5();
let hmac = new Hmac(fromUtf('key'), hasher);
hmac.update(fromUtf('message'));
console.log(toHex(hmac.finalize()));
`
Calculates SHA256 hash from string "message"
`html`
Calculates SHA256 hash from UTF string "message"
`html`
Calculates HMAC-MD5 from string "message" with key "key"
`html``
Calculates HMAC-MD5 from UTF string "message" with UTF key "key"html``