This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var crypto = require("crypto"); | |
/* variableHash - Generate a variable-length hash of `data`. | |
Adapted node version 8.x | |
------------------------ | |
Similar to the answer here: http://crypto.stackexchange.com/a/3559/4829 | |
If you want a b-bit hash of the message m, then use the first b bits of AES-CTR(SHA256(m)). | |
Rather than using the suggested algorithm in the stackexchange answer above, I developed |