function sha256(message, options) {; if (message.constructor === String) { message = _imports.convertString.UTF8.stringToBytes(message); } var H =[ 0x6A09E667, 0xBB67AE85, 0x3C6EF372, 0xA54FF53A, 0x510E527F, 0x9B05688C, 0x1F83D9AB, 0x5BE0CD19 ]; var m = bytesToWords(message); var l = message.length * 8; m[l >> 5] |= 0x80 << (24 - l % 32); m[((l + 64 >> 9) << 4) + 15] = l; for (var i=0 ; i<m.length; i += 16) { processBlock(H, m, i); } var digestbytes = wordsToBytes(H); return options && options.asBytes ? digestbytes : options && options.asString ? _imports.convertString.bytesToString(digestbytes) : _imports.bytesToHex(digestbytes) }
n/a
x2 = function (message, options) { return sha256(sha256(message, { asBytes:true }), options) }
...
## Usage
There are two methods, one for computing the hash of the input, and one for double-hashing it:
```js
sha256('hello'); // "2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824"
sha256.x2('hello'); // "d7914fe546b684688bb95f4f888a92dfc680603a75f23eb823658031fff766d9
"
```
Input is either an array of bytes or a string. **String are always interpreted as binary data**; if you have a hex-encoded string
of data to parse, first convert it to a binary string or array of bytes.
Output by default is a hexadecimal-encoded string. Other options are an array of bytes, or a binary-encoded string:
```js
...
function sha256(message, options) {; if (message.constructor === String) { message = _imports.convertString.UTF8.stringToBytes(message); } var H =[ 0x6A09E667, 0xBB67AE85, 0x3C6EF372, 0xA54FF53A, 0x510E527F, 0x9B05688C, 0x1F83D9AB, 0x5BE0CD19 ]; var m = bytesToWords(message); var l = message.length * 8; m[l >> 5] |= 0x80 << (24 - l % 32); m[((l + 64 >> 9) << 4) + 15] = l; for (var i=0 ; i<m.length; i += 16) { processBlock(H, m, i); } var digestbytes = wordsToBytes(H); return options && options.asBytes ? digestbytes : options && options.asString ? _imports.convertString.bytesToString(digestbytes) : _imports.bytesToHex(digestbytes) }
n/a
x2 = function (message, options) { return sha256(sha256(message, { asBytes:true }), options) }
...
## Usage
There are two methods, one for computing the hash of the input, and one for double-hashing it:
```js
sha256('hello'); // "2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824"
sha256.x2('hello'); // "d7914fe546b684688bb95f4f888a92dfc680603a75f23eb823658031fff766d9
"
```
Input is either an array of bytes or a string. **String are always interpreted as binary data**; if you have a hex-encoded string
of data to parse, first convert it to a binary string or array of bytes.
Output by default is a hexadecimal-encoded string. Other options are an array of bytes, or a binary-encoded string:
```js
...