JavaScript Restrictor
Browser extension that improves privacy and security
Loading...
Searching...
No Matches
sha256.js File Reference

Functions

 if (root.JS_SHA256_NO_WINDOW)
 
 if (NODE_JS)
 
 if (root.JS_SHA256_NO_NODE_JS||!Array.isArray)
 
 if (ARRAY_BUFFER &&(root.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView))
 
function Sha256 (is224, sharedMemory)
 
function HmacSha256 (key, is224, sharedMemory)
 

Variables

var ERROR = 'input is invalid type'
 
var WINDOW = typeof window === 'object'
 
var root = WINDOW ? window : {}
 
var WEB_WORKER = !WINDOW && typeof self === 'object'
 
var NODE_JS = !root.JS_SHA256_NO_NODE_JS && typeof process === 'object' && process.versions && process.versions.node
 
var COMMON_JS = !root.JS_SHA256_NO_COMMON_JS && typeof module === 'object' && module.exports
 
var AMD = typeof define === 'function' && define.amd
 
var ARRAY_BUFFER = !root.JS_SHA256_NO_ARRAY_BUFFER && typeof ArrayBuffer !== 'undefined'
 
var HEX_CHARS = '0123456789abcdef'.split('')
 
var EXTRA = [-2147483648, 8388608, 32768, 128]
 
var SHIFT = [24, 16, 8, 0]
 
var K
 
var OUTPUT_TYPES = ['hex', 'array', 'digest', 'arrayBuffer']
 
var blocks = []
 
var createOutputMethod
 
var createMethod
 
var nodeWrap
 
var createHmacOutputMethod
 
var createHmacMethod
 
Sha256 prototype update
 
Sha256 prototype finalize
 
Sha256 prototype hash
 
Sha256 prototype hex
 
Sha256 prototype toString = Sha256.prototype.hex
 
Sha256 prototype digest
 
Sha256 prototype array = Sha256.prototype.digest
 
Sha256 prototype arrayBuffer
 
HmacSha256 prototype = new Sha256()
 
var exports = createMethod()
 
exports sha256 = exports
 
exports sha224 = createMethod(true)
 
exports sha256 hmac = createHmacMethod()
 
 else
 

Function Documentation

◆ HmacSha256()

function HmacSha256 (   key,
  is224,
  sharedMemory 
)
Here is the call graph for this function:

◆ if() [1/4]

if (   ARRAY_BUFFER &&root.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)

◆ if() [2/4]

if (   NODE_JS)

◆ if() [3/4]

if ( root.JS_SHA256_NO_NODE_JS||!Array.  isArray)

◆ if() [4/4]

if ( root.  JS_SHA256_NO_WINDOW)

◆ Sha256()

function Sha256 (   is224,
  sharedMemory 
)
Here is the caller graph for this function:

Variable Documentation

◆ AMD

var AMD = typeof define === 'function' && define.amd

◆ array

◆ ARRAY_BUFFER

var ARRAY_BUFFER = !root.JS_SHA256_NO_ARRAY_BUFFER && typeof ArrayBuffer !== 'undefined'

◆ arrayBuffer

Sha256 prototype arrayBuffer
Initial value:
= function () {
this.finalize();
var buffer = new ArrayBuffer(this.is224 ? 28 : 32);
var dataView = new DataView(buffer);
dataView.setUint32(0, this.h0);
dataView.setUint32(4, this.h1);
dataView.setUint32(8, this.h2);
dataView.setUint32(12, this.h3);
dataView.setUint32(16, this.h4);
dataView.setUint32(20, this.h5);
dataView.setUint32(24, this.h6);
if (!this.is224) {
dataView.setUint32(28, this.h7);
}
return buffer;
}
Sha256 prototype finalize
Definition sha256.js:249

◆ blocks

var blocks = []

◆ COMMON_JS

var COMMON_JS = !root.JS_SHA256_NO_COMMON_JS && typeof module === 'object' && module.exports

◆ createHmacMethod

var createHmacMethod
Initial value:
= function (is224) {
var method = createHmacOutputMethod('hex', is224);
method.create = function (key) {
return new HmacSha256(key, is224);
};
method.update = function (key, message) {
return method.create(key).update(message);
};
for (var i = 0; i < OUTPUT_TYPES.length; ++i) {
var type = OUTPUT_TYPES[i];
method[type] = createHmacOutputMethod(type, is224);
}
return method;
}
let key
Definition popup.js:324
var OUTPUT_TYPES
Definition sha256.js:42
function HmacSha256(key, is224, sharedMemory)
Definition sha256.js:438
var createHmacOutputMethod
Definition sha256.js:114

◆ createHmacOutputMethod

var createHmacOutputMethod
Initial value:
= function (outputType, is224) {
return function (key, message) {
return new HmacSha256(key, is224, true).update(message)[outputType]();
};
}

◆ createMethod

var createMethod
Initial value:
= function (is224) {
var method = createOutputMethod('hex', is224);
if (NODE_JS) {
method = nodeWrap(method, is224);
}
method.create = function () {
return new Sha256(is224);
};
method.update = function (message) {
return method.create().update(message);
};
for (var i = 0; i < OUTPUT_TYPES.length; ++i) {
var type = OUTPUT_TYPES[i];
method[type] = createOutputMethod(type, is224);
}
return method;
}
var nodeWrap
Definition sha256.js:82
var createOutputMethod
Definition sha256.js:58
var NODE_JS
Definition sha256.js:20
function Sha256(is224, sharedMemory)
Definition sha256.js:135

◆ createOutputMethod

var createOutputMethod
Initial value:
= function (outputType, is224) {
return function (message) {
return new Sha256(is224, true).update(message)[outputType]();
};
}

◆ digest

Sha256 prototype digest
Initial value:
= function () {
this.finalize();
var h0 = this.h0, h1 = this.h1, h2 = this.h2, h3 = this.h3, h4 = this.h4, h5 = this.h5,
h6 = this.h6, h7 = this.h7;
var arr = [
(h0 >> 24) & 0xFF, (h0 >> 16) & 0xFF, (h0 >> 8) & 0xFF, h0 & 0xFF,
(h1 >> 24) & 0xFF, (h1 >> 16) & 0xFF, (h1 >> 8) & 0xFF, h1 & 0xFF,
(h2 >> 24) & 0xFF, (h2 >> 16) & 0xFF, (h2 >> 8) & 0xFF, h2 & 0xFF,
(h3 >> 24) & 0xFF, (h3 >> 16) & 0xFF, (h3 >> 8) & 0xFF, h3 & 0xFF,
(h4 >> 24) & 0xFF, (h4 >> 16) & 0xFF, (h4 >> 8) & 0xFF, h4 & 0xFF,
(h5 >> 24) & 0xFF, (h5 >> 16) & 0xFF, (h5 >> 8) & 0xFF, h5 & 0xFF,
(h6 >> 24) & 0xFF, (h6 >> 16) & 0xFF, (h6 >> 8) & 0xFF, h6 & 0xFF
];
if (!this.is224) {
arr.push((h7 >> 24) & 0xFF, (h7 >> 16) & 0xFF, (h7 >> 8) & 0xFF, h7 & 0xFF);
}
return arr;
}

◆ else

else
Initial value:
{
root.sha256 = exports.sha256
var root
Definition sha256.js:15
var exports
Definition sha256.js:510

◆ ERROR

var ERROR = 'input is invalid type'

[js-sha256]https://github.com/emn178/js-sha256

Version
0.10.1
Author
Chen, Yi-Cyuan [emn17.nosp@m.8@gm.nosp@m.ail.c.nosp@m.om]
License:
MIT

◆ exports

var exports = createMethod()

◆ EXTRA

var EXTRA = [-2147483648, 8388608, 32768, 128]

◆ finalize

Initial value:
= function () {
if (this.finalized) {
return;
}
this.finalized = true;
var blocks = this.blocks, i = this.lastByteIndex;
blocks[16] = this.block;
blocks[i >> 2] |= EXTRA[i & 3];
this.block = blocks[16];
if (i >= 56) {
if (!this.hashed) {
this.hash();
}
blocks[0] = this.block;
blocks[16] = blocks[1] = blocks[2] = blocks[3] =
blocks[4] = blocks[5] = blocks[6] = blocks[7] =
blocks[8] = blocks[9] = blocks[10] = blocks[11] =
blocks[12] = blocks[13] = blocks[14] = blocks[15] = 0;
}
blocks[14] = this.hBytes << 3 | this.bytes >>> 29;
blocks[15] = this.bytes << 3;
this.hash();
}
var EXTRA
Definition sha256.js:30
var blocks
Definition sha256.js:44
Sha256 prototype hash
Definition sha256.js:273

◆ hash

◆ hex

◆ HEX_CHARS

var HEX_CHARS = '0123456789abcdef'.split('')

◆ hmac

◆ K

var K
Initial value:
= [
0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,
0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,
0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,
0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,
0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2
]

◆ NODE_JS

var NODE_JS = !root.JS_SHA256_NO_NODE_JS && typeof process === 'object' && process.versions && process.versions.node

◆ nodeWrap

var nodeWrap

◆ OUTPUT_TYPES

var OUTPUT_TYPES = ['hex', 'array', 'digest', 'arrayBuffer']

◆ prototype

HmacSha256 prototype = new Sha256()

◆ root

var root = WINDOW ? window : {}

◆ sha224

root sha224 = createMethod(true)

◆ sha256

exports sha256 = exports

◆ SHIFT

var SHIFT = [24, 16, 8, 0]

◆ toString

◆ update

Sha256 prototype update

◆ WEB_WORKER

var WEB_WORKER = !WINDOW && typeof self === 'object'

◆ WINDOW

var WINDOW = typeof window === 'object'