Socket
Socket
Sign inDemoInstall

asmcrypto.js

Package Overview
Dependencies
Maintainers
3
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

asmcrypto.js - npm Package Compare versions

Comparing version 0.0.12 to 0.13.0

.editorconfig

0

bower.json

@@ -0,0 +0,0 @@ {

533

Gruntfile.js

@@ -1,372 +0,3 @@

// Default modules to build
var defaults = [
'utils',
'globals',
'aes-cbc',
'aes-gcm',
'sha1',
'sha256',
'hmac-sha1',
'hmac-sha256',
'pbkdf2-hmac-sha1',
'pbkdf2-hmac-sha256',
'rng',
'bn',
'rsa-pkcs1',
'rng-globals',
'origin',
];
// Map each of the modules and their deps
// Topo-sorted
var modules = [
{
name: 'common',
files: [ 'src/errors.js' ]
},
{
name: 'utils',
files: [ 'src/utils.js' ],
implies: [ 'exports' ]
},
{
name: 'origin',
files: [ 'src/origin.js' ],
},
{
name: 'exports',
files: [ 'src/exports.js' ],
depends: [ 'utils' ]
},
{
name: 'globals',
files: [ 'src/globals.js' ],
depends: [ 'common' ]
},
{
name: 'aes',
files: [ 'src/aes/aes.asm.js', 'src/aes/aes.js' ],
depends: [ 'common', 'utils' ]
},
{
name: 'aes-ecb',
files: [ 'src/aes/ecb/ecb.js' ],
depends: [ 'aes' ],
implies: [ 'aes-exports', 'aes-ecb-exports' ]
},
{
name: 'aes-cbc',
files: [ 'src/aes/cbc/cbc.js' ],
depends: [ 'aes' ],
implies: [ 'aes-exports', 'aes-cbc-exports' ]
},
{
name: 'aes-cfb',
files: [ 'src/aes/cfb/cfb.js' ],
depends: [ 'aes' ],
implies: [ 'aes-exports', 'aes-cfb-exports' ]
},
{
name: 'aes-ofb',
files: [ 'src/aes/ofb/ofb.js' ],
depends: [ 'aes' ],
implies: [ 'aes-exports', 'aes-ofb-exports' ]
},
{
name: 'aes-ctr',
files: [ 'src/aes/ctr/ctr.js' ],
depends: [ 'aes' ],
implies: [ 'aes-exports', 'aes-ctr-exports' ]
},
{
name: 'aes-ccm',
files: [ 'src/aes/ccm/ccm.js' ],
depends: [ 'aes', 'aes-ctr' ],
implies: [ 'aes-exports', 'aes-ccm-exports' ]
},
{
name: 'aes-gcm',
files: [ 'src/aes/gcm/gcm.js' ],
depends: [ 'aes', 'aes-ctr' ],
implies: [ 'aes-exports', 'aes-gcm-exports' ]
},
{
name: 'aes-exports',
files: [ 'src/aes/exports.js' ],
depends: [ 'aes' ]
},
{
name: 'aes-ecb-exports',
files: [ 'src/aes/ecb/exports.js' ],
depends: [ 'aes-ecb', 'aes-exports' ]
},
{
name: 'aes-cbc-exports',
files: [ 'src/aes/cbc/exports.js' ],
depends: [ 'aes-cbc', 'aes-exports' ]
},
{
name: 'aes-cfb-exports',
files: [ 'src/aes/cfb/exports.js' ],
depends: [ 'aes-cfb', 'aes-exports' ]
},
{
name: 'aes-ofb-exports',
files: [ 'src/aes/ofb/exports.js' ],
depends: [ 'aes-ofb', 'aes-exports' ]
},
{
name: 'aes-ctr-exports',
files: [ 'src/aes/ctr/exports.js' ],
depends: [ 'aes-ctr', 'aes-exports' ]
},
{
name: 'aes-ccm-exports',
files: [ 'src/aes/ccm/exports.js' ],
depends: [ 'aes-ccm', 'aes-exports' ]
},
{
name: 'aes-gcm-exports',
files: [ 'src/aes/gcm/exports.js' ],
depends: [ 'aes-gcm', 'aes-exports' ]
},
{
name: 'hash',
files: [ 'src/hash/hash.js' ],
depends: [ 'common', 'utils' ]
},
{
name: 'sha1',
files: [ 'src/hash/sha1/sha1.asm.js', 'src/hash/sha1/sha1.js' ],
depends: [ 'common', 'hash', 'utils' ],
implies: [ 'sha1-exports' ]
},
{
name: 'sha1-exports',
files: [ 'src/hash/sha1/exports.js' ],
depends: [ 'sha1' ]
},
{
name: 'sha256',
files: [ 'src/hash/sha256/sha256.asm.js', 'src/hash/sha256/sha256.js' ],
depends: [ 'common', 'hash', 'utils' ],
implies: [ 'sha256-exports' ]
},
{
name: 'sha256-exports',
files: [ 'src/hash/sha256/exports.js' ],
depends: [ 'sha256' ],
},
{
name: 'sha512',
files: [ 'src/hash/sha512/sha512.asm.js', 'src/hash/sha512/sha512.js' ],
depends: [ 'common', 'hash', 'utils' ],
implies: [ 'sha512-exports' ]
},
{
name: 'sha512-exports',
files: [ 'src/hash/sha512/exports.js' ],
depends: [ 'sha512' ]
},
{
name: 'hmac',
files: [ 'src/hmac/hmac.js' ],
depends: [ 'common', 'utils' ]
},
{
name: 'hmac-sha1',
files: [ 'src/hmac/hmac-sha1.js' ],
depends: [ 'hmac', 'sha1' ],
implies: [ 'hmac-sha1-exports' ]
},
{
name: 'hmac-sha256',
files: [ 'src/hmac/hmac-sha256.js' ],
depends: [ 'hmac', 'sha256' ],
implies: [ 'hmac-sha256-exports' ]
},
{
name: 'hmac-sha512',
files: [ 'src/hmac/hmac-sha512.js' ],
depends: [ 'hmac', 'sha512' ],
implies: [ 'hmac-sha512-exports' ]
},
{
name: 'hmac-sha1-exports',
files: [ 'src/hmac/exports-hmac-sha1.js' ],
depends: [ 'hmac-sha1' ]
},
{
name: 'hmac-sha256-exports',
files: [ 'src/hmac/exports-hmac-sha256.js' ],
depends: [ 'hmac-sha256' ]
},
{
name: 'hmac-sha512-exports',
files: [ 'src/hmac/exports-hmac-sha512.js' ],
depends: [ 'hmac-sha512' ]
},
{
name: 'pbkdf2',
files: [ 'src/pbkdf2/pbkdf2.js' ],
depends: [ 'common', 'utils' ]
},
{
name: 'pbkdf2-hmac-sha1',
files: [ 'src/pbkdf2/pbkdf2-hmac-sha1.js' ],
depends: [ 'pbkdf2', 'hmac-sha1' ],
implies: [ 'pbkdf2-hmac-sha1-exports' ]
},
{
name: 'pbkdf2-hmac-sha256',
files: [ 'src/pbkdf2/pbkdf2-hmac-sha256.js' ],
depends: [ 'pbkdf2', 'hmac-sha256' ],
implies: [ 'pbkdf2-hmac-sha256-exports' ]
},
{
name: 'pbkdf2-hmac-sha512',
files: [ 'src/pbkdf2/pbkdf2-hmac-sha512.js' ],
depends: [ 'pbkdf2', 'hmac-sha512' ],
implies: [ 'pbkdf2-hmac-sha512-exports' ]
},
{
name: 'pbkdf2-hmac-sha1-exports',
files: [ 'src/pbkdf2/exports-pbkdf2-hmac-sha1.js' ],
depends: [ 'pbkdf2' ]
},
{
name: 'pbkdf2-hmac-sha256-exports',
files: [ 'src/pbkdf2/exports-pbkdf2-hmac-sha256.js' ],
depends: [ 'pbkdf2' ]
},
{
name: 'pbkdf2-hmac-sha512-exports',
files: [ 'src/pbkdf2/exports-pbkdf2-hmac-sha512.js' ],
depends: [ 'pbkdf2' ]
},
{
name: 'rng',
files: [ 'src/random/isaac.js', 'src/random/random.js' ],
depends: [ 'common', 'utils', 'pbkdf2-hmac-sha256' ],
implies: [ 'rng-exports' ]
},
{
name: 'rng-exports',
files: [ 'src/random/exports.js' ],
depends: [ 'rng' ]
},
{
name: 'rng-globals',
files: [ 'src/random/globals.js' ],
depends: [ 'rng' ]
},
{
name: 'bn',
files: [ 'src/bignum/bigint.asm.js', 'src/bignum/bignum.js', 'src/bignum/extgcd.js', 'src/bignum/modulus.js', 'src/bignum/prime.js' ],
depends: [ 'common', 'rng' ],
implies: [ 'bn-exports' ]
},
{
name: 'bn-exports',
files: [ 'src/bignum/exports.js' ],
depends: [ 'bn' ]
},
{
name: 'rsa',
files: [ 'src/rsa/rsa.js', 'src/rsa/genkey.js' ],
depends: [ 'bn', 'rng' ],
implies: [ 'rsa-keygen-exports' ]
},
{
name: 'rsa-raw',
files: [ 'src/rsa/raw.js' ],
depends: [ 'rsa' ],
implies: [ 'rsa-keygen-exports', 'rsa-raw-exports' ]
},
{
name: 'rsa-pkcs1',
files: [ 'src/rsa/pkcs1.js' ],
depends: [ 'rsa' ],
implies: [ 'rsa-keygen-exports', 'rsa-oaep-sha1-exports', 'rsa-oaep-sha256-exports', 'rsa-oaep-sha512-exports',
'rsa-pss-sha1-exports', 'rsa-pss-sha256-exports', 'rsa-pss-sha512-exports' ]
},
{
name: 'rsa-keygen-exports',
files: [ 'src/rsa/exports-keygen.js' ],
depends: [ 'rsa' ]
},
{
name: 'rsa-raw-exports',
files: [ 'src/rsa/exports-raw.js' ],
depends: [ 'rsa-raw' ]
},
{
name: 'rsa-oaep-sha1-exports',
files: [ 'src/rsa/exports-oaep-sha1.js' ],
depends: [ 'rsa-pkcs1', 'sha1' ]
},
{
name: 'rsa-oaep-sha256-exports',
files: [ 'src/rsa/exports-oaep-sha256.js' ],
depends: [ 'rsa-pkcs1', 'sha256' ]
},
{
name: 'rsa-oaep-sha512-exports',
files: [ 'src/rsa/exports-oaep-sha512.js' ],
depends: [ 'rsa-pkcs1', 'sha512' ]
},
{
name: 'rsa-pss-sha1-exports',
files: [ 'src/rsa/exports-pss-sha1.js' ],
depends: [ 'rsa-pkcs1', 'sha1' ]
},
{
name: 'rsa-pss-sha256-exports',
files: [ 'src/rsa/exports-pss-sha256.js' ],
depends: [ 'rsa-pkcs1', 'sha256' ]
},
{
name: 'rsa-pss-sha512-exports',
files: [ 'src/rsa/exports-pss-sha512.js' ],
depends: [ 'rsa-pkcs1', 'sha512' ]
}
];
// Supported browsers
var browsers = [
// Latest browsers
{
browserName: 'Firefox',
},
{
browserName: 'Chrome',
},
{
browserName: 'Internet Explorer',
},
{
browserName: 'Safari',
platform: 'OS X 10.11',
},
// Legacy browsers
{
browserName: 'Firefox',
version: '22',
},
{
browserName: 'Internet Explorer',
version: '10',
},
{
browserName: 'Opera',
version: '12',
},
{
browserName: 'Safari',
version: '5.1',
},
];
// Grunt setup
module.exports = function ( grunt ) {
module.exports = function (grunt) {
grunt.loadNpmTasks('grunt-contrib-uglify');

@@ -378,77 +9,5 @@ grunt.loadNpmTasks('grunt-contrib-concat');

grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-saucelabs');
grunt.loadNpmTasks('grunt-jsdoc');
grunt.loadNpmTasks('grunt-rollup');
function sources () {
// Get the list of modules split by commas
var includeModules = {};
( grunt.option('with') || process.env.WITH || '' ).split(',')
.map( function ( moduleName ) { return moduleName.trim() } )
.filter( function ( moduleName ) { return moduleName.length > 0 } )
.forEach( function ( moduleName ) { includeModules[ moduleName ] = true } );
// Check for keyword "ALL"
if ( includeModules.ALL ) {
includeModules = {};
modules.forEach( function ( module ) { includeModules[ module.name ] = true } );
}
// No modules specified, put defaults here
if ( Object.keys( includeModules ).length === 0 )
defaults.forEach( function ( moduleName ) { includeModules[moduleName] = true } );
// Trace build configuration
var traceModules = modules.filter( function ( module ) { return includeModules[module.name] } )
.map( function ( module ) { return module.name } );
grunt.log.writeln( "Building modules: " + traceModules.join(", ") );
// Recurse into dependancy tree
function traverseDependancies ( moduleName, includeModules ) {
if ( includeModules[moduleName] )
return;
var result = modules.filter( function ( module ) { return module.name === moduleName } );
if ( !result || result.length === 0 )
grunt.fail.fatal( "An unknown module '" + moduleName + "' specified" );
includeModules[ result[0].name ] = true;
// Get the deps and call recursively
var depends = result[0].depends || [];
depends.forEach( function ( dependsName ) { traverseDependancies( dependsName, includeModules ) } );
}
// Loop each of the specified module names
var deepIncludeModules = {};
Object.keys(includeModules).forEach( function ( moduleName ) { traverseDependancies( moduleName, deepIncludeModules ) } );
// Insert implied modules only when theirs dependancies are there
var impliedModules = {};
for ( var i = 0; i < modules.length; i++ ) {
if ( !includeModules[ modules[i].name ] || !modules[i].implies ) continue;
modules[i].implies.forEach( function ( moduleName ) { impliedModules[moduleName] = true } );
}
for ( var i = 0; i < modules.length; i++ ) {
if ( !modules[i].depends ) continue;
modules[i].depends.forEach( function ( moduleName ) { if ( !deepIncludeModules[moduleName] ) delete impliedModules[ modules[i].name ] } );
if ( !impliedModules[ modules[i].name ] ) continue;
deepIncludeModules[ modules[i].name ] = true;
}
Object.keys(impliedModules).forEach( function ( moduleName ) { deepIncludeModules[moduleName] = true } );
// Hold the array of files as specified by the modules
var sourceFiles = [];
for ( var i = 0; i < modules.length; i++ ) {
if ( !deepIncludeModules[ modules[i].name ] ) continue;
sourceFiles = sourceFiles.concat(modules[i].files);
}
// grunt.log.writeln( "Building files:\n" + sourceFiles.join("\n") );
grunt.config( 'sources.files', sourceFiles );
return true;
}
// Finally, configure

@@ -458,17 +17,48 @@ grunt.initConfig({

concat: {
rollup: {
options: {
banner: "/*! asmCrypto<%= pkg.version && ' v'+pkg.version %>, (c) 2013 <%= pkg.author.name %>, opensource.org/licenses/<%= pkg.license %> */\n"
+ "(function ( exports, global ) {\n\n",
footer: "\n\n'function'==typeof define&&define.amd?define([],function(){return exports}):"
+ "'object'==typeof module&&module.exports?module.exports=exports:global.asmCrypto=exports;"
+ "\n\nreturn exports;\n})( {}, this );",
format: 'umd',
sourceMap: true,
sourceMapStyle: 'link'
banner: "/*! asmCrypto<%= pkg.version && ' v'+pkg.version %>, (c) 2018 <%= pkg.author.name %>, opensource.org/licenses/<%= pkg.license %> */",
},
default: {
options: {
moduleName: 'asmCrypto',
},
files: {
'asmcrypto.js': './src/entry-default.js'
}
},
default_esm: {
options: {
format: 'es',
},
files: {
'asmcrypto.mjs': './src/entry-default.js'
}
},
all: {
options: {
moduleName: 'asmCrypto',
},
files: {
'asmcrypto.js': '<%= sources.files %>'
'asmcrypto.js': './src/entry-export_all.js'
}
}
},
all_esm: {
options: {
format: 'es',
},
files: {
'asmcrypto.mjs': './src/entry-export_all.js'
}
},
test_AES_ASM: {
options: {
moduleName: 'AES_asm',
},
files: {
'test/aes.asm.js': './src/aes/aes.asm.js'
}
},
},

@@ -484,7 +74,7 @@

screwIE8: true,
banner: "/*! asmCrypto<%= pkg.version && ' v'+pkg.version %>, (c) 2013 <%= pkg.author.name %>, opensource.org/licenses/<%= pkg.license %> */"
banner: "/*! asmCrypto<%= pkg.version && ' v'+pkg.version %>, (c) 2018 <%= pkg.author.name %>, opensource.org/licenses/<%= pkg.license %> */"
},
all: {
files: {
'asmcrypto.js': 'asmcrypto.js'
'asmcrypto.min.js': 'asmcrypto.js'
}

@@ -496,3 +86,3 @@ }

all: {
src: [ 'src/**/*.js', 'README.md' ],
src: ['src/**/*.js', 'README.md'],
options: {

@@ -507,4 +97,4 @@ destination: 'doc'

options: {
timeout: 60000,
urls: [ 'http://localhost:9999/index.html' ]
timeout: 120000,
urls: ['http://localhost:9999/index.html']
}

@@ -514,14 +104,2 @@ }

'saucelabs-qunit': {
all: {
options: {
testname: 'asmcrypto.js',
urls: [ 'http://localhost:9999/' ],
browsers: browsers,
build: process.env.TRAVIS_JOB_ID,
'max-duration': 600
}
}
},
connect: {

@@ -532,3 +110,3 @@ all: {

port: 9999,
base: [ 'test', '.' ],
base: ['test', '.'],
directory: 'test'

@@ -541,4 +119,4 @@ }

all: {
files: '<%= sources.files %>',
tasks: ['sources','concat']
files: 'src/**/*.js',
tasks: ['rollup:all', 'rollup:test_AES_ASM']
}

@@ -550,2 +128,4 @@ },

'asmcrypto.js.map',
'test/aes.asm.js',
'test/aes.asm.js.map',
'doc/'

@@ -555,7 +135,6 @@ ]

grunt.registerTask('sources', sources);
grunt.registerTask('default', ['sources','concat','uglify']);
grunt.registerTask('devel', ['sources','concat','connect','watch']);
grunt.registerTask('test', ['connect','qunit']);
grunt.registerTask('sauce', ['connect','saucelabs-qunit']);
grunt.registerTask('default', ['rollup:default', 'rollup:test_AES_ASM', 'uglify']);
grunt.registerTask('esm', ['rollup:default_esm']);
grunt.registerTask('devel', ['rollup:all', 'rollup:test_AES_ASM', 'connect', 'watch']);
grunt.registerTask('test', ['connect', 'qunit']);
};
{
"name": "asmcrypto.js",
"description": "Asm.js implementation of WebCrypto API",
"homepage": "https://github.com/vibornoff/asmcrypto.js",
"main": "asmcrypto.js",
"version": "0.0.12",
"license": "MIT",
"author": {
"name": "Artem S Vybornov",
"email": "vybornov@gmail.com",
"web": "https://github.com/vibornoff"
"name": "asmcrypto.js",
"version": "0.13.0",
"description": "Asm.js implementation of WebCrypto API",
"homepage": "https://github.com/vibornoff/asmcrypto.js",
"main": "asmcrypto.js",
"module": "asmcrypto.mjs",
"license": "MIT",
"author": {
"name": "Artem S Vybornov",
"email": "vybornov@gmail.com",
"web": "https://github.com/vibornoff"
},
"contributors": [
{
"name": "Ádám Lippai",
"email": "adam@rigo.sk",
"web": "https://github.com/alippai"
},
"contributors": [
{
"name": "Ádám Lippai",
"email": "adam@rigo.sk",
"web": "https://github.com/alippai"
},
{
"name": "Ximin Luo",
"email": "infinity0@pwned.gg",
"web": "https://github.com/infinity0"
}
],
"repository": {
"type": "git",
"url": "https://github.com/vibornoff/asmcrypto.js.git"
},
"devDependencies": {
"uglify-js": "vibornoff/UglifyJS2",
"grunt": "~0.4",
"grunt-cli": "~0.1",
"grunt-contrib-uglify": "~0.9",
"grunt-contrib-concat": "~0.5",
"grunt-contrib-qunit": "~0.4",
"grunt-contrib-connect": "~0.7",
"grunt-contrib-watch": "~0.2",
"grunt-contrib-clean": "~0.4",
"grunt-saucelabs": "~8.0",
"grunt-jsdoc": "~0.6"
},
"engines": {
"node": "~0.10"
},
"scripts": {
"prepublish": "grunt",
"test": "grunt test"
{
"name": "Ximin Luo",
"email": "infinity0@pwned.gg",
"web": "https://github.com/infinity0"
}
],
"repository": {
"type": "git",
"url": "https://github.com/vibornoff/asmcrypto.js.git"
},
"devDependencies": {
"uglify-js": "vibornoff/UglifyJS2",
"grunt": "~1.0",
"grunt-cli": "~1.2",
"grunt-contrib-uglify": "~3.3",
"grunt-contrib-concat": "~1.0",
"grunt-contrib-qunit": "~2.0",
"grunt-contrib-connect": "~1.0",
"grunt-contrib-watch": "~1.0",
"grunt-contrib-clean": "~1.1",
"grunt-jsdoc": "~2.2",
"grunt-rollup": "^8.2.0"
},
"scripts": {
"prepublish": "grunt && grunt esm",
"test": "grunt test"
}
}

@@ -0,0 +0,0 @@ asmCrypto [![Build Status](https://travis-ci.org/vibornoff/asmcrypto.js.svg?branch=master)](https://travis-ci.org/vibornoff/asmcrypto.js) [![Selenium Test Status](https://saucelabs.com/buildstatus/vibornoff)](https://saucelabs.com/u/vibornoff) [![Join the chat at https://gitter.im/vibornoff/asmcrypto.js](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/vibornoff/asmcrypto.js?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![CDNJS version](https://img.shields.io/cdnjs/v/asmCrypto.svg)](https://cdnjs.com/libraries/asmCrypto)

@@ -6,3 +6,3 @@ /**

*/
var AES_asm = function () {
export var AES_asm = function () {
"use strict";

@@ -140,7 +140,6 @@

* @class
* @param {GlobalScope} global - global scope object (e.g. <code>window</code>)
* @param {Object} foreign - <i>ignored</i>
* @param {ArrayBuffer} buffer - heap buffer to link with
*/
var wrapper = function ( global, foreign, buffer ) {
var wrapper = function ( foreign, buffer ) {
// Init AES stuff for the first time

@@ -147,0 +146,0 @@ if ( !aes_init_done ) aes_init();

@@ -1,6 +0,10 @@

function AES ( options ) {
import {AES_asm} from './aes.asm';
import {_heap_init, _heap_write, is_buffer, is_bytes, is_string, string_to_bytes} from '../utils';
import {IllegalArgumentError, SecurityError} from '../errors';
export function AES ( options ) {
options = options || {};
this.heap = _heap_init( Uint8Array, options ).subarray( AES_asm.HEAP_DATA );
this.asm = options.asm || AES_asm( global, null, this.heap.buffer );
this.asm = options.asm || AES_asm( null, this.heap.buffer );
this.mode = null;

@@ -12,3 +16,3 @@ this.key = null;

function AES_set_key ( key ) {
export function AES_set_key ( key ) {
if ( key !== undefined ) {

@@ -49,3 +53,3 @@ if ( is_buffer(key) || is_bytes(key) ) {

function AES_set_iv ( iv ) {
export function AES_set_iv ( iv ) {
if ( iv !== undefined ) {

@@ -85,3 +89,3 @@ if ( is_buffer(iv) || is_bytes(iv) ) {

function AES_reset ( options ) {
export function AES_reset ( options ) {
options = options || {};

@@ -100,3 +104,3 @@

function AES_Encrypt_process ( data ) {
export function AES_Encrypt_process ( data ) {
if ( is_string(data) )

@@ -152,3 +156,3 @@ data = string_to_bytes(data);

function AES_Encrypt_finish ( data ) {
export function AES_Encrypt_finish ( data ) {
var presult = null,

@@ -200,3 +204,3 @@ prlen = 0;

function AES_Decrypt_process ( data ) {
export function AES_Decrypt_process ( data ) {
if ( is_string(data) )

@@ -258,3 +262,3 @@ data = string_to_bytes(data);

function AES_Decrypt_finish ( data ) {
export function AES_Decrypt_finish ( data ) {
var presult = null,

@@ -261,0 +265,0 @@ prlen = 0;

/**
* Cipher Block Chaining Mode (CBC)
*/
import {AES, AES_Decrypt_finish, AES_Decrypt_process, AES_Encrypt_finish, AES_Encrypt_process, AES_reset} from '../aes';
function AES_CBC ( options ) {
export function AES_CBC_constructor (options ) {
this.padding = true;

@@ -14,3 +15,3 @@ this.iv = null;

var AES_CBC_prototype = AES_CBC.prototype;
var AES_CBC_prototype = AES_CBC_constructor.prototype;
AES_CBC_prototype.BLOCK_SIZE = 16;

@@ -21,4 +22,4 @@ AES_CBC_prototype.reset = AES_reset;

function AES_CBC_Encrypt ( options ) {
AES_CBC.call( this, options );
export function AES_CBC_Encrypt ( options ) {
AES_CBC_constructor.call( this, options );
}

@@ -32,4 +33,4 @@

function AES_CBC_Decrypt ( options ) {
AES_CBC.call( this, options );
export function AES_CBC_Decrypt ( options ) {
AES_CBC_constructor.call( this, options );
}

@@ -36,0 +37,0 @@

@@ -0,1 +1,4 @@

import {AES_CBC_constructor, AES_CBC_Decrypt, AES_CBC_Encrypt} from './cbc';
import {_AES_asm_instance, _AES_heap_instance} from '../exports';
/**

@@ -5,6 +8,6 @@ * AES-CBC exports

function AES_CBC_encrypt_bytes ( data, key, padding, iv ) {
function AES_CBC_encrypt_bytes (data, key, padding, iv ) {
if ( data === undefined ) throw new SyntaxError("data required");
if ( key === undefined ) throw new SyntaxError("key required");
return new AES_CBC( { heap: _AES_heap_instance, asm: _AES_asm_instance, key: key, padding: padding, iv: iv } ).encrypt(data).result;
return new AES_CBC_constructor( { heap: _AES_heap_instance, asm: _AES_asm_instance, key: key, padding: padding, iv: iv } ).encrypt(data).result;
}

@@ -15,10 +18,10 @@

if ( key === undefined ) throw new SyntaxError("key required");
return new AES_CBC( { heap: _AES_heap_instance, asm: _AES_asm_instance, key: key, padding: padding, iv: iv } ).decrypt(data).result;
return new AES_CBC_constructor( { heap: _AES_heap_instance, asm: _AES_asm_instance, key: key, padding: padding, iv: iv } ).decrypt(data).result;
}
exports.AES_CBC = AES_CBC;
exports.AES_CBC.encrypt = AES_CBC_encrypt_bytes;
exports.AES_CBC.decrypt = AES_CBC_decrypt_bytes;
export var AES_CBC = AES_CBC_constructor;
AES_CBC.encrypt = AES_CBC_encrypt_bytes;
AES_CBC.decrypt = AES_CBC_decrypt_bytes;
exports.AES_CBC.Encrypt = AES_CBC_Encrypt;
exports.AES_CBC.Decrypt = AES_CBC_Decrypt;
AES_CBC.Encrypt = AES_CBC_Encrypt;
AES_CBC.Decrypt = AES_CBC_Decrypt;

@@ -16,2 +16,8 @@ /**

import { AES_asm} from '../aes.asm'
import { AES, AES_reset, AES_set_iv } from '../aes'
import {_heap_write, is_buffer, is_bytes, is_number, is_string, string_to_bytes} from '../../utils';
import {AES_CTR_set_options} from '../ctr/ctr';
import {IllegalArgumentError, IllegalStateError, SecurityError} from '../../errors';
function _cbc_mac_process ( data ) {

@@ -37,3 +43,3 @@ var heap = this.heap,

function AES_CCM ( options ) {
export function AES_CCM_constructor (options ) {
this.tagSize = 16;

@@ -52,8 +58,8 @@ this.lengthSize = 4;

function AES_CCM_Encrypt ( options ) {
AES_CCM.call( this, options );
export function AES_CCM_Encrypt ( options ) {
AES_CCM_constructor.call( this, options );
}
function AES_CCM_Decrypt ( options ) {
AES_CCM.call( this, options );
export function AES_CCM_Decrypt ( options ) {
AES_CCM_constructor.call( this, options );
}

@@ -417,3 +423,3 @@

var AES_CCM_prototype = AES_CCM.prototype;
var AES_CCM_prototype = AES_CCM_constructor.prototype;
AES_CCM_prototype.BLOCK_SIZE = 16;

@@ -420,0 +426,0 @@ AES_CCM_prototype.reset = AES_CCM_reset;

@@ -5,3 +5,6 @@ /**

function AES_CCM_encrypt_bytes ( data, key, nonce, adata, tagSize ) {
import {_AES_asm_instance, _AES_heap_instance} from '../exports';
import { AES_CCM_constructor, AES_CCM_Decrypt, AES_CCM_Encrypt} from './ccm';
function AES_CCM_encrypt_bytes (data, key, nonce, adata, tagSize ) {
if ( data === undefined ) throw new SyntaxError("data required");

@@ -11,3 +14,3 @@ if ( key === undefined ) throw new SyntaxError("key required");

var dataLength = data.length || 0;
return new AES_CCM( { heap: _AES_heap_instance, asm: _AES_asm_instance, key: key, nonce: nonce, adata: adata, tagSize: tagSize, dataLength: dataLength } ).encrypt(data).result;
return new AES_CCM_constructor( { heap: _AES_heap_instance, asm: _AES_asm_instance, key: key, nonce: nonce, adata: adata, tagSize: tagSize, dataLength: dataLength } ).encrypt(data).result;
}

@@ -21,10 +24,10 @@

tagSize = tagSize || 16;
return new AES_CCM( { heap: _AES_heap_instance, asm: _AES_asm_instance, key: key, nonce: nonce, adata: adata, tagSize: tagSize, dataLength: dataLength-tagSize } ).decrypt(data).result;
return new AES_CCM_constructor( { heap: _AES_heap_instance, asm: _AES_asm_instance, key: key, nonce: nonce, adata: adata, tagSize: tagSize, dataLength: dataLength-tagSize } ).decrypt(data).result;
}
exports.AES_CCM = AES_CCM;
exports.AES_CCM.encrypt = AES_CCM_encrypt_bytes;
exports.AES_CCM.decrypt = AES_CCM_decrypt_bytes;
export var AES_CCM = AES_CCM_constructor;
AES_CCM.encrypt = AES_CCM_encrypt_bytes;
AES_CCM.decrypt = AES_CCM_decrypt_bytes;
exports.AES_CCM.Encrypt = AES_CCM_Encrypt;
exports.AES_CCM.Decrypt = AES_CCM_Decrypt;
AES_CCM.Encrypt = AES_CCM_Encrypt;
AES_CCM.Decrypt = AES_CCM_Decrypt;

@@ -5,3 +5,5 @@ /**

function AES_CFB ( options ) {
import {AES, AES_Decrypt_finish, AES_Decrypt_process, AES_Encrypt_finish, AES_Encrypt_process, AES_reset} from '../aes';
export function AES_CFB_constructor (options ) {
this.iv = null;

@@ -14,3 +16,3 @@

var AES_CFB_prototype = AES_CFB.prototype;
var AES_CFB_prototype = AES_CFB_constructor.prototype;
AES_CFB_prototype.BLOCK_SIZE = 16;

@@ -21,4 +23,4 @@ AES_CFB_prototype.reset = AES_reset;

function AES_CFB_Encrypt ( options ) {
AES_CFB.call( this, options );
export function AES_CFB_Encrypt ( options ) {
AES_CFB_constructor.call( this, options );
}

@@ -32,4 +34,4 @@

function AES_CFB_Decrypt ( options ) {
AES_CFB.call( this, options );
export function AES_CFB_Decrypt ( options ) {
AES_CFB_constructor.call( this, options );
}

@@ -36,0 +38,0 @@

@@ -5,6 +5,9 @@ /**

import {_AES_asm_instance, _AES_heap_instance} from '../exports';
import { AES_CFB_constructor, AES_CFB_Decrypt, AES_CFB_Encrypt} from './cfb';
function AES_CFB_encrypt_bytes ( data, key, iv ) {
if ( data === undefined ) throw new SyntaxError("data required");
if ( key === undefined ) throw new SyntaxError("key required");
return new AES_CFB( { heap: _AES_heap_instance, asm: _AES_asm_instance, key: key, iv: iv } ).encrypt(data).result;
return new AES_CFB_constructor( { heap: _AES_heap_instance, asm: _AES_asm_instance, key: key, iv: iv } ).encrypt(data).result;
}

@@ -15,10 +18,11 @@

if ( key === undefined ) throw new SyntaxError("key required");
return new AES_CFB( { heap: _AES_heap_instance, asm: _AES_asm_instance, key: key, iv: iv } ).decrypt(data).result;
return new AES_CFB_constructor( { heap: _AES_heap_instance, asm: _AES_asm_instance, key: key, iv: iv } ).decrypt(data).result;
}
exports.AES_CFB = AES_CFB;
exports.AES_CFB.encrypt = AES_CFB_encrypt_bytes;
exports.AES_CFB.decrypt = AES_CFB_decrypt_bytes;
export var AES_CFB = AES_CFB_constructor;
exports.AES_CFB.Encrypt = AES_CFB_Encrypt;
exports.AES_CFB.Decrypt = AES_CFB_Decrypt;
AES_CFB.encrypt = AES_CFB_encrypt_bytes;
AES_CFB.decrypt = AES_CFB_decrypt_bytes;
AES_CFB.Encrypt = AES_CFB_Encrypt;
AES_CFB.Decrypt = AES_CFB_Decrypt;

@@ -5,3 +5,7 @@ /**

function AES_CTR ( options ) {
import {AES, AES_Encrypt_finish, AES_Encrypt_process, AES_reset} from '../aes';
import {is_buffer, is_bytes, is_number, is_string, string_to_bytes} from '../../utils';
import {IllegalArgumentError} from '../../errors';
export function AES_CTR_constructor (options ) {
this.nonce = null,

@@ -16,7 +20,7 @@ this.counter = 0,

function AES_CTR_Crypt ( options ) {
AES_CTR.call( this, options );
export function AES_CTR_Crypt ( options ) {
AES_CTR_constructor.call( this, options );
}
function AES_CTR_set_options ( nonce, counter, size ) {
export function AES_CTR_set_options ( nonce, counter, size ) {
if ( size !== undefined ) {

@@ -88,3 +92,3 @@ if ( size < 8 || size > 48 )

var AES_CTR_prototype = AES_CTR.prototype;
var AES_CTR_prototype = AES_CTR_constructor.prototype;
AES_CTR_prototype.BLOCK_SIZE = 16;

@@ -91,0 +95,0 @@ AES_CTR_prototype.reset = AES_CTR_reset;

@@ -5,2 +5,5 @@ /**

import {_AES_asm_instance, _AES_heap_instance} from '../exports';
import { AES_CTR_constructor, AES_CTR_Crypt } from './ctr'
function AES_CTR_crypt_bytes ( data, key, nonce ) {

@@ -10,10 +13,10 @@ if ( data === undefined ) throw new SyntaxError("data required");

if ( nonce === undefined ) throw new SyntaxError("nonce required");
return new AES_CTR( { heap: _AES_heap_instance, asm: _AES_asm_instance, key: key, nonce: nonce } ).encrypt(data).result;
return new AES_CTR_constructor( { heap: _AES_heap_instance, asm: _AES_asm_instance, key: key, nonce: nonce } ).encrypt(data).result;
}
exports.AES_CTR = AES_CTR;
exports.AES_CTR.encrypt = AES_CTR_crypt_bytes;
exports.AES_CTR.decrypt = AES_CTR_crypt_bytes;
export var AES_CTR = AES_CTR_constructor;
exports.AES_CTR.Encrypt =
exports.AES_CTR.Decrypt = AES_CTR_Crypt;
AES_CTR.encrypt = AES_CTR_crypt_bytes;
AES_CTR.decrypt = AES_CTR_crypt_bytes;
AES_CTR.Encrypt = AES_CTR.Decrypt = AES_CTR_Crypt;

@@ -5,3 +5,5 @@ /**

function AES_ECB ( options ) {
import {AES, AES_Decrypt_finish, AES_Decrypt_process, AES_Encrypt_finish, AES_Encrypt_process, AES_reset} from '../aes';
export function AES_ECB_constructor (options ) {
this.padding = true;

@@ -14,3 +16,3 @@

var AES_ECB_prototype = AES_ECB.prototype;
var AES_ECB_prototype = AES_ECB_constructor.prototype;
AES_ECB_prototype.BLOCK_SIZE = 16;

@@ -21,4 +23,4 @@ AES_ECB_prototype.reset = AES_reset;

function AES_ECB_Encrypt ( options ) {
AES_ECB.call( this, options );
export function AES_ECB_Encrypt ( options ) {
AES_ECB_constructor.call( this, options );
}

@@ -32,4 +34,4 @@

function AES_ECB_Decrypt ( options ) {
AES_ECB.call( this, options );
export function AES_ECB_Decrypt ( options ) {
AES_ECB_constructor.call( this, options );
}

@@ -36,0 +38,0 @@

@@ -5,6 +5,9 @@ /**

import {_AES_asm_instance, _AES_heap_instance} from '../exports';
import { AES_ECB_constructor, AES_ECB_Decrypt, AES_ECB_Encrypt} from './ecb';
function AES_ECB_encrypt_bytes ( data, key, padding ) {
if ( data === undefined ) throw new SyntaxError("data required");
if ( key === undefined ) throw new SyntaxError("key required");
return new AES_ECB( { heap: _AES_heap_instance, asm: _AES_asm_instance, key: key, padding: padding } ).encrypt(data).result;
return new AES_ECB_constructor( { heap: _AES_heap_instance, asm: _AES_asm_instance, key: key, padding: padding } ).encrypt(data).result;
}

@@ -15,10 +18,11 @@

if ( key === undefined ) throw new SyntaxError("key required");
return new AES_ECB( { heap: _AES_heap_instance, asm: _AES_asm_instance, key: key, padding: padding } ).decrypt(data).result;
return new AES_ECB_constructor( { heap: _AES_heap_instance, asm: _AES_asm_instance, key: key, padding: padding } ).decrypt(data).result;
}
exports.AES_ECB = AES_ECB;
exports.AES_ECB.encrypt = AES_ECB_encrypt_bytes;
exports.AES_ECB.decrypt = AES_ECB_decrypt_bytes;
export var AES_ECB = AES_ECB_constructor;
exports.AES_ECB.Encrypt = AES_ECB_Encrypt;
exports.AES_ECB.Decrypt = AES_ECB_Decrypt;
AES_ECB.encrypt = AES_ECB_encrypt_bytes;
AES_ECB.decrypt = AES_ECB_decrypt_bytes;
AES_ECB.Encrypt = AES_ECB_Encrypt;
AES_ECB.Decrypt = AES_ECB_Decrypt;
// shared asm.js module and heap
var _AES_heap_instance = new Uint8Array(0x100000),
_AES_asm_instance = AES_asm( global, null, _AES_heap_instance.buffer );
import {AES_asm} from './aes.asm';
export var _AES_heap_instance = new Uint8Array(0x100000);
export var _AES_asm_instance = AES_asm( null, _AES_heap_instance.buffer );

@@ -5,2 +5,6 @@ /**

import {_AES_asm_instance, _AES_heap_instance} from '../exports';
import { AES_GCM_constructor, AES_GCM_Decrypt, AES_GCM_Encrypt} from './gcm';
function AES_GCM_encrypt_bytes ( data, key, nonce, adata, tagSize ) {

@@ -10,3 +14,3 @@ if ( data === undefined ) throw new SyntaxError("data required");

if ( nonce === undefined ) throw new SyntaxError("nonce required");
return new AES_GCM( { heap: _AES_heap_instance, asm: _AES_asm_instance, key: key, nonce: nonce, adata: adata, tagSize: tagSize } ).encrypt(data).result;
return new AES_GCM_constructor( { heap: _AES_heap_instance, asm: _AES_asm_instance, key: key, nonce: nonce, adata: adata, tagSize: tagSize } ).encrypt(data).result;
}

@@ -18,10 +22,11 @@

if ( nonce === undefined ) throw new SyntaxError("nonce required");
return new AES_GCM( { heap: _AES_heap_instance, asm: _AES_asm_instance, key: key, nonce: nonce, adata: adata, tagSize: tagSize } ).decrypt(data).result;
return new AES_GCM_constructor( { heap: _AES_heap_instance, asm: _AES_asm_instance, key: key, nonce: nonce, adata: adata, tagSize: tagSize } ).decrypt(data).result;
}
exports.AES_GCM = AES_GCM;
exports.AES_GCM.encrypt = AES_GCM_encrypt_bytes;
exports.AES_GCM.decrypt = AES_GCM_decrypt_bytes;
export var AES_GCM = AES_GCM_constructor;
exports.AES_GCM.Encrypt = AES_GCM_Encrypt;
exports.AES_GCM.Decrypt = AES_GCM_Decrypt;
AES_GCM.encrypt = AES_GCM_encrypt_bytes;
AES_GCM.decrypt = AES_GCM_decrypt_bytes;
AES_GCM.Encrypt = AES_GCM_Encrypt;
AES_GCM.Decrypt = AES_GCM_Decrypt;

@@ -5,2 +5,7 @@ /**

import {AES_asm} from '../aes.asm'
import {AES, AES_reset, AES_set_iv} from '../aes';
import {_heap_write, is_buffer, is_bytes, is_number, is_string, string_to_bytes} from '../../utils';
import {IllegalArgumentError, IllegalStateError, SecurityError} from '../../errors';
var _AES_GCM_data_maxLength = 68719476704; // 2^36 - 2^5

@@ -26,3 +31,3 @@

function AES_GCM ( options ) {
export function AES_GCM_constructor (options ) {
this.nonce = null;

@@ -39,8 +44,8 @@ this.adata = null;

function AES_GCM_Encrypt ( options ) {
AES_GCM.call( this, options );
export function AES_GCM_Encrypt ( options ) {
AES_GCM_constructor.call( this, options );
}
function AES_GCM_Decrypt ( options ) {
AES_GCM.call( this, options );
export function AES_GCM_Decrypt ( options ) {
AES_GCM_constructor.call( this, options );
}

@@ -414,3 +419,3 @@

var AES_GCM_prototype = AES_GCM.prototype;
var AES_GCM_prototype = AES_GCM_constructor.prototype;
AES_GCM_prototype.BLOCK_SIZE = 16;

@@ -417,0 +422,0 @@ AES_GCM_prototype.reset = AES_GCM_reset;

@@ -5,13 +5,17 @@ /**

import {_AES_asm_instance, _AES_heap_instance} from '../exports';
import {AES_OFB_constructor, AES_OFB_Crypt} from './ofb';
function AES_OFB_crypt_bytes ( data, key, iv ) {
if ( data === undefined ) throw new SyntaxError("data required");
if ( key === undefined ) throw new SyntaxError("key required");
return new AES_OFB( { heap: _AES_heap_instance, asm: _AES_asm_instance, key: key, iv: iv } ).encrypt(data).result;
return new AES_OFB_constructor( { heap: _AES_heap_instance, asm: _AES_asm_instance, key: key, iv: iv } ).encrypt(data).result;
}
exports.AES_OFB = AES_OFB;
exports.AES_OFB.encrypt = AES_OFB_crypt_bytes;
exports.AES_OFB.decrypt = AES_OFB_crypt_bytes;
export var AES_OFB = AES_OFB_constructor;
exports.AES_OFB.Encrypt =
exports.AES_OFB.Decrypt = AES_OFB_Crypt;
AES_OFB.encrypt = AES_OFB_crypt_bytes;
AES_OFB.decrypt = AES_OFB_crypt_bytes;
AES_OFB.Encrypt = AES_OFB.Decrypt = AES_OFB_Crypt;

@@ -5,3 +5,5 @@ /**

function AES_OFB ( options ) {
import {AES, AES_Encrypt_finish, AES_Encrypt_process, AES_reset} from '../aes';
export function AES_OFB_constructor (options ) {
this.iv = null;

@@ -14,7 +16,7 @@

function AES_OFB_Crypt ( options ) {
AES_OFB.call( this, options );
export function AES_OFB_Crypt ( options ) {
AES_OFB_constructor.call( this, options );
}
var AES_OFB_prototype = AES_OFB.prototype;
var AES_OFB_prototype = AES_OFB_constructor.prototype;
AES_OFB_prototype.BLOCK_SIZE = 16;

@@ -21,0 +23,0 @@ AES_OFB_prototype.reset = AES_reset;

@@ -1,3 +0,7 @@

function is_big_number ( a ) {
return ( a instanceof BigNumber );
import {bigint_asm} from './bigint.asm';
import {is_buffer, is_bytes, is_number, is_string, string_to_bytes} from '../utils';
import {IllegalArgumentError} from '../errors';
export function is_big_number ( a ) {
return ( a instanceof BigNumber_constructor );
}

@@ -7,10 +11,11 @@

var _bigint_stdlib = { Uint32Array: Uint32Array, Math: global.Math },
_bigint_heap = new Uint32Array(0x100000),
_bigint_asm;
export var _bigint_stdlib = { Uint32Array: Uint32Array, Math: Math };
export var _bigint_heap = new Uint32Array(0x100000);
export var _bigint_asm;
function _half_imul ( a, b ) {
return a * b | 0;
}
if ( _bigint_stdlib.Math.imul === undefined ) {
function _half_imul ( a, b ) {
return a * b | 0;
}
_bigint_stdlib.Math.imul = _half_imul;

@@ -28,3 +33,3 @@ _bigint_asm = bigint_asm( _bigint_stdlib, null, _bigint_heap.buffer );

function BigNumber ( num ) {
export function BigNumber_constructor (num ) {
var limbs = _BigNumber_ZERO_limbs,

@@ -186,3 +191,3 @@ bitlen = 0,

var clamped = new BigNumber,
var clamped = new BigNumber_constructor,
n = (b + 31) >> 5,

@@ -219,3 +224,3 @@ k = b % 32;

var sliced = new BigNumber, slimbs,
var sliced = new BigNumber_constructor, slimbs,
n = f >> 5, m = (f + b + 31) >> 5, l = (b + 31) >> 5,

@@ -249,3 +254,3 @@ t = f % 32, k = b % 32;

function BigNumber_negate () {
var negative = new BigNumber;
var negative = new BigNumber_constructor;

@@ -261,3 +266,3 @@ negative.limbs = this.limbs;

if ( !is_big_number(that) )
that = new BigNumber(that);
that = new BigNumber_constructor(that);

@@ -283,3 +288,3 @@ var alimbs = this.limbs, alimbcnt = alimbs.length,

if ( !is_big_number(that) )
that = new BigNumber(that);
that = new BigNumber_constructor(that);

@@ -294,3 +299,3 @@ if ( !this.sign )

bbitlen = that.bitLength, blimbs = that.limbs, blimbcnt = blimbs.length, bsign = that.sign,
rbitlen, rlimbcnt, rsign, rof, result = new BigNumber;
rbitlen, rlimbcnt, rsign, rof, result = new BigNumber_constructor;

@@ -339,3 +344,3 @@ rbitlen = ( abitlen > bbitlen ? abitlen : bbitlen ) + ( asign * bsign > 0 ? 1 : 0 );

if ( !is_big_number(that) )
that = new BigNumber(that);
that = new BigNumber_constructor(that);

@@ -347,3 +352,3 @@ return this.add( that.negate() );

if ( !is_big_number(that) )
that = new BigNumber(that);
that = new BigNumber_constructor(that);

@@ -355,3 +360,3 @@ if ( !this.sign || !that.sign )

bbitlen = that.bitLength, blimbs = that.limbs, blimbcnt = blimbs.length,
rbitlen, rlimbcnt, result = new BigNumber;
rbitlen, rlimbcnt, result = new BigNumber_constructor;

@@ -386,3 +391,3 @@ rbitlen = abitlen + bbitlen;

var abitlen = this.bitLength, alimbs = this.limbs, alimbcnt = alimbs.length,
rbitlen, rlimbcnt, result = new BigNumber;
rbitlen, rlimbcnt, result = new BigNumber_constructor;

@@ -412,3 +417,3 @@ rbitlen = abitlen << 1;

if ( !is_big_number(that) )
that = new BigNumber(that);
that = new BigNumber_constructor(that);

@@ -434,3 +439,3 @@ var abitlen = this.bitLength, alimbs = this.limbs, alimbcnt = alimbs.length,

if ( qlimbcnt ) {
quotient = new BigNumber;
quotient = new BigNumber_constructor;
quotient.limbs = new Uint32Array( _bigint_heap.subarray( pQ>>2, (pQ>>2)+qlimbcnt ) );

@@ -443,3 +448,3 @@ quotient.bitLength = abitlen < (qlimbcnt<<5) ? abitlen : (qlimbcnt<<5);

if ( rlimbcnt ) {
remainder = new BigNumber;
remainder = new BigNumber_constructor;
remainder.limbs = new Uint32Array( _bigint_heap.subarray( pA>>2, (pA>>2)+rlimbcnt ) );;

@@ -458,3 +463,3 @@ remainder.bitLength = bbitlen < (rlimbcnt<<5) ? bbitlen : (rlimbcnt<<5);

var BigNumberPrototype = BigNumber.prototype = new Number;
var BigNumberPrototype = BigNumber_constructor.prototype = new Number;
BigNumberPrototype.toString = BigNumber_toString;

@@ -478,6 +483,6 @@ BigNumberPrototype.toBytes = BigNumber_toBytes;

var BigNumber_ZERO = new BigNumber(0),
BigNumber_ONE = new BigNumber(1);
export var BigNumber_ZERO = new BigNumber_constructor(0);
export var BigNumber_ONE = new BigNumber_constructor(1);
Object.freeze(BigNumber_ZERO);
Object.freeze(BigNumber_ONE);

@@ -0,1 +1,6 @@

import {BigNumber_constructor, BigNumber_ONE, BigNumber_ZERO} from './bignum';
import {BigNumber_extGCD} from './extgcd';
import "./prime";
export var BigNumber = BigNumber_constructor;
BigNumber.ZERO = BigNumber_ZERO;

@@ -6,3 +11,2 @@ BigNumber.ONE = BigNumber_ONE;

exports.BigNumber = BigNumber;
exports.Modulus = Modulus;
export { Modulus } from "./modulus";

@@ -1,2 +0,4 @@

function Number_extGCD ( a, b ) {
import {BigNumber_constructor, BigNumber_ONE, BigNumber_ZERO, is_big_number} from './bignum';
export function Number_extGCD (a, b ) {
var sa = ( a < 0 ) ? -1 : 1,

@@ -40,8 +42,8 @@ sb = ( b < 0 ) ? -1 : 1,

function BigNumber_extGCD ( a, b ) {
export function BigNumber_extGCD ( a, b ) {
if ( !is_big_number(a) )
a = new BigNumber(a);
a = new BigNumber_constructor(a);
if ( !is_big_number(b) )
b = new BigNumber(b);
b = new BigNumber_constructor(b);

@@ -48,0 +50,0 @@ var sa = a.sign, sb = b.sign;

@@ -0,6 +1,10 @@

import {BigNumber_constructor, is_big_number} from './bignum';
import {BigNumber_extGCD, Number_extGCD} from './extgcd';
import {_bigint_asm, _bigint_heap} from './bignum'
/**
* Modulus
*/
function Modulus () {
BigNumber.apply( this, arguments );
export function Modulus () {
BigNumber_constructor.apply( this, arguments );

@@ -18,3 +22,3 @@ if ( this.valueOf() < 1 )

limbs[limbs.length-1] = 1;
comodulus = new BigNumber();
comodulus = new BigNumber_constructor();
comodulus.sign = 1;

@@ -48,6 +52,6 @@ comodulus.bitLength = bitlen;

if ( !is_big_number(a) )
a = new BigNumber(a);
a = new BigNumber_constructor(a);
if ( a.bitLength <= 32 && this.bitLength <= 32 )
return new BigNumber( a.valueOf() % this.valueOf() );
return new BigNumber_constructor( a.valueOf() % this.valueOf() );

@@ -80,6 +84,6 @@ if ( a.compare(this) < 0 )

if ( !is_big_number(g) )
g = new BigNumber(g);
g = new BigNumber_constructor(g);
if ( !is_big_number(e) )
e = new BigNumber(e);
e = new BigNumber_constructor(e);

@@ -163,3 +167,3 @@ // count exponent set bits

var result = new BigNumber();
var result = new BigNumber_constructor();
result.limbs = new Uint32Array( _bigint_heap.subarray( pR>>2, (pR>>2)+nlimbcnt ) );

@@ -172,5 +176,5 @@ result.bitLength = n.bitLength;

var ModulusPrototype = Modulus.prototype = new BigNumber;
var ModulusPrototype = Modulus.prototype = new BigNumber_constructor;
ModulusPrototype.reduce = Modulus_reduce;
ModulusPrototype.inverse = Modulus_inverse;
ModulusPrototype.power = Modulus_power;
// Tests if the number supplied is a Miller-Rabin strong probable prime
function _BigNumber_isMillerRabinProbablePrime ( rounds ) {
var t = new BigNumber(this),
import {BigNumber_constructor} from './bignum';
import {pow2_ceil} from '../utils';
import {Random_getValues} from '../random/random';
import {Modulus} from './modulus';
function _BigNumber_isMillerRabinProbablePrime (rounds ) {
var t = new BigNumber_constructor(this),
s = 0;

@@ -11,4 +16,4 @@ t.limbs[0] -= 1;

var m = new Modulus(this),
m1 = this.subtract(BigNumber_ONE),
a = new BigNumber(this),
m1 = this.subtract(BigNumber_constructor.ONE),
a = new BigNumber_constructor(this),
l = this.limbs.length-1;

@@ -23,3 +28,3 @@ while ( a.limbs[l] === 0 ) l--;

var x = m.power( a, t );
if ( x.compare(BigNumber_ONE) === 0 ) continue;
if ( x.compare(BigNumber_constructor.ONE) === 0 ) continue;
if ( x.compare(m1) === 0 ) continue;

@@ -30,3 +35,3 @@

x = x.square().divide(m).remainder;
if ( x.compare(BigNumber_ONE) === 0 ) return false;
if ( x.compare(BigNumber_constructor.ONE) === 0 ) return false;
if ( x.compare(m1) === 0 ) break;

@@ -105,5 +110,5 @@ }

// Returns strong pseudoprime of a specified bit length
function BigNumber_randomProbablePrime ( bitlen, filter ) {
export function BigNumber_randomProbablePrime ( bitlen, filter ) {
var limbcnt = (bitlen + 31) >> 5,
prime = new BigNumber({ sign: 1, bitLength: bitlen, limbs: limbcnt }),
prime = new BigNumber_constructor({ sign: 1, bitLength: bitlen, limbs: limbcnt }),
limbs = prime.limbs;

@@ -122,3 +127,3 @@

// Damgaard, Landrock, Pomerance: Average case error estimates for the strong probable prime test.
var s = (bitlen * global.Math.LN2) | 0,
var s = (bitlen * Math.LN2) | 0,
r = 27;

@@ -160,4 +165,4 @@ if ( bitlen >= 250 ) r = 12;

BigNumberPrototype.isProbablePrime = BigNumber_isProbablePrime;
BigNumber_constructor.prototype.isProbablePrime = BigNumber_isProbablePrime;
BigNumber.randomProbablePrime = BigNumber_randomProbablePrime;
BigNumber_constructor.randomProbablePrime = BigNumber_randomProbablePrime;

@@ -1,8 +0,8 @@

function IllegalStateError () { var err = Error.apply( this, arguments ); this.message = err.message, this.stack = err.stack; }
export function IllegalStateError () { var err = Error.apply( this, arguments ); this.message = err.message, this.stack = err.stack; }
IllegalStateError.prototype = Object.create( Error.prototype, { name: { value: 'IllegalStateError' } } );
function IllegalArgumentError () { var err = Error.apply( this, arguments ); this.message = err.message, this.stack = err.stack; }
export function IllegalArgumentError () { var err = Error.apply( this, arguments ); this.message = err.message, this.stack = err.stack; }
IllegalArgumentError.prototype = Object.create( Error.prototype, { name: { value: 'IllegalArgumentError' } } );
function SecurityError () { var err = Error.apply( this, arguments ); this.message = err.message, this.stack = err.stack; }
export function SecurityError () { var err = Error.apply( this, arguments ); this.message = err.message, this.stack = err.stack; }
SecurityError.prototype = Object.create( Error.prototype, { name: { value: 'SecurityError' } } );

@@ -1,2 +0,5 @@

function hash_reset () {
import {_heap_write, is_buffer, is_bytes, is_string, string_to_bytes} from '../utils';
import {IllegalStateError} from '../errors';
export function hash_reset () {
this.result = null;

@@ -11,3 +14,3 @@ this.pos = 0;

function hash_process ( data ) {
export function hash_process ( data ) {
if ( this.result !== null )

@@ -53,3 +56,3 @@ throw new IllegalStateError("state must be reset before processing new data");

function hash_finish () {
export function hash_finish () {
if ( this.result !== null )

@@ -56,0 +59,0 @@ throw new IllegalStateError("state must be reset before processing new data");

@@ -5,3 +5,6 @@ /**

function sha1_bytes ( data ) {
import {get_sha1_instance, sha1_constructor} from './sha1';
import {bytes_to_base64, bytes_to_hex} from '../../utils';
function sha1_bytes (data ) {
if ( data === undefined ) throw new SyntaxError("data required");

@@ -21,6 +24,6 @@ return get_sha1_instance().reset().process(data).finish().result;

sha1_constructor.bytes = sha1_bytes;
sha1_constructor.hex = sha1_hex;
sha1_constructor.base64 = sha1_base64;
export var SHA1 = sha1_constructor;
exports.SHA1 = sha1_constructor;
SHA1.bytes = sha1_bytes;
SHA1.hex = sha1_hex;
SHA1.base64 = sha1_base64;

@@ -1,2 +0,2 @@

function sha1_asm ( stdlib, foreign, buffer ) {
export function sha1_asm ( stdlib, foreign, buffer ) {
"use asm";

@@ -3,0 +3,0 @@

@@ -1,5 +0,9 @@

var _sha1_block_size = 64,
_sha1_hash_size = 20;
import {sha1_asm} from './sha1.asm';
import {hash_finish, hash_process, hash_reset} from '../hash';
import {_heap_init} from '../../utils';
function sha1_constructor ( options ) {
export var _sha1_block_size = 64;
export var _sha1_hash_size = 20;
export function sha1_constructor ( options ) {
options = options || {};

@@ -17,2 +21,4 @@

sha1_constructor.BLOCK_SIZE = _sha1_block_size;
sha1_constructor.NAME = "sha1";
sha1_constructor.HASH_SIZE = _sha1_hash_size;

@@ -26,5 +32,5 @@ var sha1_prototype = sha1_constructor.prototype;

function get_sha1_instance () {
export function get_sha1_instance () {
if ( sha1_instance === null ) sha1_instance = new sha1_constructor( { heapSize: 0x100000 } );
return sha1_instance;
}

@@ -5,3 +5,6 @@ /**

function sha256_bytes ( data ) {
import {get_sha256_instance, sha256_constructor} from './sha256';
import {bytes_to_base64, bytes_to_hex} from '../../utils';
function sha256_bytes (data ) {
if ( data === undefined ) throw new SyntaxError("data required");

@@ -21,6 +24,5 @@ return get_sha256_instance().reset().process(data).finish().result;

sha256_constructor.bytes = sha256_bytes;
sha256_constructor.hex = sha256_hex;
sha256_constructor.base64 = sha256_base64;
exports.SHA256 = sha256_constructor;
export var SHA256 = sha256_constructor;
SHA256.bytes = sha256_bytes;
SHA256.hex = sha256_hex;
SHA256.base64 = sha256_base64;

@@ -1,2 +0,2 @@

function sha256_asm ( stdlib, foreign, buffer ) {
export function sha256_asm ( stdlib, foreign, buffer ) {
"use asm";

@@ -33,4 +33,3 @@

var a = 0, b = 0, c = 0, d = 0, e = 0, f = 0, g = 0, h = 0,
t = 0;
var a = 0, b = 0, c = 0, d = 0, e = 0, f = 0, g = 0, h = 0;

@@ -45,370 +44,370 @@ a = H0;

h = H7;
// 0
t = ( w0 + h + ( e>>>6 ^ e>>>11 ^ e>>>25 ^ e<<26 ^ e<<21 ^ e<<7 ) + ( g ^ e & (f^g) ) + 0x428a2f98 )|0;
h = g; g = f; f = e; e = ( d + t )|0; d = c; c = b; b = a;
a = ( t + ( (b & c) ^ ( d & (b ^ c) ) ) + ( b>>>2 ^ b>>>13 ^ b>>>22 ^ b<<30 ^ b<<19 ^ b<<10 ) )|0;
h = ( w0 + h + ( e>>>6 ^ e>>>11 ^ e>>>25 ^ e<<26 ^ e<<21 ^ e<<7 ) + ( g ^ e & (f^g) ) + 0x428a2f98 )|0;
d = ( d + h )|0;
h = ( h + ( (a & b) ^ ( c & (a ^ b) ) ) + ( a>>>2 ^ a>>>13 ^ a>>>22 ^ a<<30 ^ a<<19 ^ a<<10 ) )|0;
// 1
t = ( w1 + h + ( e>>>6 ^ e>>>11 ^ e>>>25 ^ e<<26 ^ e<<21 ^ e<<7 ) + ( g ^ e & (f^g) ) + 0x71374491 )|0;
h = g; g = f; f = e; e = ( d + t )|0; d = c; c = b; b = a;
a = ( t + ( (b & c) ^ ( d & (b ^ c) ) ) + ( b>>>2 ^ b>>>13 ^ b>>>22 ^ b<<30 ^ b<<19 ^ b<<10 ) )|0;
g = ( w1 + g + ( d>>>6 ^ d>>>11 ^ d>>>25 ^ d<<26 ^ d<<21 ^ d<<7 ) + ( f ^ d & (e^f) ) + 0x71374491 )|0;
c = ( c + g )|0;
g = ( g + ( (h & a) ^ ( b & (h ^ a) ) ) + ( h>>>2 ^ h>>>13 ^ h>>>22 ^ h<<30 ^ h<<19 ^ h<<10 ) )|0;
// 2
t = ( w2 + h + ( e>>>6 ^ e>>>11 ^ e>>>25 ^ e<<26 ^ e<<21 ^ e<<7 ) + ( g ^ e & (f^g) ) + 0xb5c0fbcf )|0;
h = g; g = f; f = e; e = ( d + t )|0; d = c; c = b; b = a;
a = ( t + ( (b & c) ^ ( d & (b ^ c) ) ) + ( b>>>2 ^ b>>>13 ^ b>>>22 ^ b<<30 ^ b<<19 ^ b<<10 ) )|0;
f = ( w2 + f + ( c>>>6 ^ c>>>11 ^ c>>>25 ^ c<<26 ^ c<<21 ^ c<<7 ) + ( e ^ c & (d^e) ) + 0xb5c0fbcf )|0;
b = ( b + f )|0;
f = ( f + ( (g & h) ^ ( a & (g ^ h) ) ) + ( g>>>2 ^ g>>>13 ^ g>>>22 ^ g<<30 ^ g<<19 ^ g<<10 ) )|0;
// 3
t = ( w3 + h + ( e>>>6 ^ e>>>11 ^ e>>>25 ^ e<<26 ^ e<<21 ^ e<<7 ) + ( g ^ e & (f^g) ) + 0xe9b5dba5 )|0;
h = g; g = f; f = e; e = ( d + t )|0; d = c; c = b; b = a;
a = ( t + ( (b & c) ^ ( d & (b ^ c) ) ) + ( b>>>2 ^ b>>>13 ^ b>>>22 ^ b<<30 ^ b<<19 ^ b<<10 ) )|0;
e = ( w3 + e + ( b>>>6 ^ b>>>11 ^ b>>>25 ^ b<<26 ^ b<<21 ^ b<<7 ) + ( d ^ b & (c^d) ) + 0xe9b5dba5 )|0;
a = ( a + e )|0;
e = ( e + ( (f & g) ^ ( h & (f ^ g) ) ) + ( f>>>2 ^ f>>>13 ^ f>>>22 ^ f<<30 ^ f<<19 ^ f<<10 ) )|0;
// 4
t = ( w4 + h + ( e>>>6 ^ e>>>11 ^ e>>>25 ^ e<<26 ^ e<<21 ^ e<<7 ) + ( g ^ e & (f^g) ) + 0x3956c25b )|0;
h = g; g = f; f = e; e = ( d + t )|0; d = c; c = b; b = a;
a = ( t + ( (b & c) ^ ( d & (b ^ c) ) ) + ( b>>>2 ^ b>>>13 ^ b>>>22 ^ b<<30 ^ b<<19 ^ b<<10 ) )|0;
d = ( w4 + d + ( a>>>6 ^ a>>>11 ^ a>>>25 ^ a<<26 ^ a<<21 ^ a<<7 ) + ( c ^ a & (b^c) ) + 0x3956c25b )|0;
h = ( h + d )|0;
d = ( d + ( (e & f) ^ ( g & (e ^ f) ) ) + ( e>>>2 ^ e>>>13 ^ e>>>22 ^ e<<30 ^ e<<19 ^ e<<10 ) )|0;
// 5
t = ( w5 + h + ( e>>>6 ^ e>>>11 ^ e>>>25 ^ e<<26 ^ e<<21 ^ e<<7 ) + ( g ^ e & (f^g) ) + 0x59f111f1 )|0;
h = g; g = f; f = e; e = ( d + t )|0; d = c; c = b; b = a;
a = ( t + ( (b & c) ^ ( d & (b ^ c) ) ) + ( b>>>2 ^ b>>>13 ^ b>>>22 ^ b<<30 ^ b<<19 ^ b<<10 ) )|0;
c = ( w5 + c + ( h>>>6 ^ h>>>11 ^ h>>>25 ^ h<<26 ^ h<<21 ^ h<<7 ) + ( b ^ h & (a^b) ) + 0x59f111f1 )|0;
g = ( g + c )|0;
c = ( c + ( (d & e) ^ ( f & (d ^ e) ) ) + ( d>>>2 ^ d>>>13 ^ d>>>22 ^ d<<30 ^ d<<19 ^ d<<10 ) )|0;
// 6
t = ( w6 + h + ( e>>>6 ^ e>>>11 ^ e>>>25 ^ e<<26 ^ e<<21 ^ e<<7 ) + ( g ^ e & (f^g) ) + 0x923f82a4 )|0;
h = g; g = f; f = e; e = ( d + t )|0; d = c; c = b; b = a;
a = ( t + ( (b & c) ^ ( d & (b ^ c) ) ) + ( b>>>2 ^ b>>>13 ^ b>>>22 ^ b<<30 ^ b<<19 ^ b<<10 ) )|0;
b = ( w6 + b + ( g>>>6 ^ g>>>11 ^ g>>>25 ^ g<<26 ^ g<<21 ^ g<<7 ) + ( a ^ g & (h^a) ) + 0x923f82a4 )|0;
f = ( f + b )|0;
b = ( b + ( (c & d) ^ ( e & (c ^ d) ) ) + ( c>>>2 ^ c>>>13 ^ c>>>22 ^ c<<30 ^ c<<19 ^ c<<10 ) )|0;
// 7
t = ( w7 + h + ( e>>>6 ^ e>>>11 ^ e>>>25 ^ e<<26 ^ e<<21 ^ e<<7 ) + ( g ^ e & (f^g) ) + 0xab1c5ed5 )|0;
h = g; g = f; f = e; e = ( d + t )|0; d = c; c = b; b = a;
a = ( t + ( (b & c) ^ ( d & (b ^ c) ) ) + ( b>>>2 ^ b>>>13 ^ b>>>22 ^ b<<30 ^ b<<19 ^ b<<10 ) )|0;
a = ( w7 + a + ( f>>>6 ^ f>>>11 ^ f>>>25 ^ f<<26 ^ f<<21 ^ f<<7 ) + ( h ^ f & (g^h) ) + 0xab1c5ed5 )|0;
e = ( e + a )|0;
a = ( a + ( (b & c) ^ ( d & (b ^ c) ) ) + ( b>>>2 ^ b>>>13 ^ b>>>22 ^ b<<30 ^ b<<19 ^ b<<10 ) )|0;
// 8
t = ( w8 + h + ( e>>>6 ^ e>>>11 ^ e>>>25 ^ e<<26 ^ e<<21 ^ e<<7 ) + ( g ^ e & (f^g) ) + 0xd807aa98 )|0;
h = g; g = f; f = e; e = ( d + t )|0; d = c; c = b; b = a;
a = ( t + ( (b & c) ^ ( d & (b ^ c) ) ) + ( b>>>2 ^ b>>>13 ^ b>>>22 ^ b<<30 ^ b<<19 ^ b<<10 ) )|0;
h = ( w8 + h + ( e>>>6 ^ e>>>11 ^ e>>>25 ^ e<<26 ^ e<<21 ^ e<<7 ) + ( g ^ e & (f^g) ) + 0xd807aa98 )|0;
d = ( d + h )|0;
h = ( h + ( (a & b) ^ ( c & (a ^ b) ) ) + ( a>>>2 ^ a>>>13 ^ a>>>22 ^ a<<30 ^ a<<19 ^ a<<10 ) )|0;
// 9
t = ( w9 + h + ( e>>>6 ^ e>>>11 ^ e>>>25 ^ e<<26 ^ e<<21 ^ e<<7 ) + ( g ^ e & (f^g) ) + 0x12835b01 )|0;
h = g; g = f; f = e; e = ( d + t )|0; d = c; c = b; b = a;
a = ( t + ( (b & c) ^ ( d & (b ^ c) ) ) + ( b>>>2 ^ b>>>13 ^ b>>>22 ^ b<<30 ^ b<<19 ^ b<<10 ) )|0;
g = ( w9 + g + ( d>>>6 ^ d>>>11 ^ d>>>25 ^ d<<26 ^ d<<21 ^ d<<7 ) + ( f ^ d & (e^f) ) + 0x12835b01 )|0;
c = ( c + g )|0;
g = ( g + ( (h & a) ^ ( b & (h ^ a) ) ) + ( h>>>2 ^ h>>>13 ^ h>>>22 ^ h<<30 ^ h<<19 ^ h<<10 ) )|0;
// 10
t = ( w10 + h + ( e>>>6 ^ e>>>11 ^ e>>>25 ^ e<<26 ^ e<<21 ^ e<<7 ) + ( g ^ e & (f^g) ) + 0x243185be )|0;
h = g; g = f; f = e; e = ( d + t )|0; d = c; c = b; b = a;
a = ( t + ( (b & c) ^ ( d & (b ^ c) ) ) + ( b>>>2 ^ b>>>13 ^ b>>>22 ^ b<<30 ^ b<<19 ^ b<<10 ) )|0;
f = ( w10 + f + ( c>>>6 ^ c>>>11 ^ c>>>25 ^ c<<26 ^ c<<21 ^ c<<7 ) + ( e ^ c & (d^e) ) + 0x243185be )|0;
b = ( b + f )|0;
f = ( f + ( (g & h) ^ ( a & (g ^ h) ) ) + ( g>>>2 ^ g>>>13 ^ g>>>22 ^ g<<30 ^ g<<19 ^ g<<10 ) )|0;
// 11
t = ( w11 + h + ( e>>>6 ^ e>>>11 ^ e>>>25 ^ e<<26 ^ e<<21 ^ e<<7 ) + ( g ^ e & (f^g) ) + 0x550c7dc3 )|0;
h = g; g = f; f = e; e = ( d + t )|0; d = c; c = b; b = a;
a = ( t + ( (b & c) ^ ( d & (b ^ c) ) ) + ( b>>>2 ^ b>>>13 ^ b>>>22 ^ b<<30 ^ b<<19 ^ b<<10 ) )|0;
e = ( w11 + e + ( b>>>6 ^ b>>>11 ^ b>>>25 ^ b<<26 ^ b<<21 ^ b<<7 ) + ( d ^ b & (c^d) ) + 0x550c7dc3 )|0;
a = ( a + e )|0;
e = ( e + ( (f & g) ^ ( h & (f ^ g) ) ) + ( f>>>2 ^ f>>>13 ^ f>>>22 ^ f<<30 ^ f<<19 ^ f<<10 ) )|0;
// 12
t = ( w12 + h + ( e>>>6 ^ e>>>11 ^ e>>>25 ^ e<<26 ^ e<<21 ^ e<<7 ) + ( g ^ e & (f^g) ) + 0x72be5d74 )|0;
h = g; g = f; f = e; e = ( d + t )|0; d = c; c = b; b = a;
a = ( t + ( (b & c) ^ ( d & (b ^ c) ) ) + ( b>>>2 ^ b>>>13 ^ b>>>22 ^ b<<30 ^ b<<19 ^ b<<10 ) )|0;
d = ( w12 + d + ( a>>>6 ^ a>>>11 ^ a>>>25 ^ a<<26 ^ a<<21 ^ a<<7 ) + ( c ^ a & (b^c) ) + 0x72be5d74 )|0;
h = ( h + d )|0;
d = ( d + ( (e & f) ^ ( g & (e ^ f) ) ) + ( e>>>2 ^ e>>>13 ^ e>>>22 ^ e<<30 ^ e<<19 ^ e<<10 ) )|0;
// 13
t = ( w13 + h + ( e>>>6 ^ e>>>11 ^ e>>>25 ^ e<<26 ^ e<<21 ^ e<<7 ) + ( g ^ e & (f^g) ) + 0x80deb1fe )|0;
h = g; g = f; f = e; e = ( d + t )|0; d = c; c = b; b = a;
a = ( t + ( (b & c) ^ ( d & (b ^ c) ) ) + ( b>>>2 ^ b>>>13 ^ b>>>22 ^ b<<30 ^ b<<19 ^ b<<10 ) )|0;
c = ( w13 + c + ( h>>>6 ^ h>>>11 ^ h>>>25 ^ h<<26 ^ h<<21 ^ h<<7 ) + ( b ^ h & (a^b) ) + 0x80deb1fe )|0;
g = ( g + c )|0;
c = ( c + ( (d & e) ^ ( f & (d ^ e) ) ) + ( d>>>2 ^ d>>>13 ^ d>>>22 ^ d<<30 ^ d<<19 ^ d<<10 ) )|0;
// 14
t = ( w14 + h + ( e>>>6 ^ e>>>11 ^ e>>>25 ^ e<<26 ^ e<<21 ^ e<<7 ) + ( g ^ e & (f^g) ) + 0x9bdc06a7 )|0;
h = g; g = f; f = e; e = ( d + t )|0; d = c; c = b; b = a;
a = ( t + ( (b & c) ^ ( d & (b ^ c) ) ) + ( b>>>2 ^ b>>>13 ^ b>>>22 ^ b<<30 ^ b<<19 ^ b<<10 ) )|0;
b = ( w14 + b + ( g>>>6 ^ g>>>11 ^ g>>>25 ^ g<<26 ^ g<<21 ^ g<<7 ) + ( a ^ g & (h^a) ) + 0x9bdc06a7 )|0;
f = ( f + b )|0;
b = ( b + ( (c & d) ^ ( e & (c ^ d) ) ) + ( c>>>2 ^ c>>>13 ^ c>>>22 ^ c<<30 ^ c<<19 ^ c<<10 ) )|0;
// 15
t = ( w15 + h + ( e>>>6 ^ e>>>11 ^ e>>>25 ^ e<<26 ^ e<<21 ^ e<<7 ) + ( g ^ e & (f^g) ) + 0xc19bf174 )|0;
h = g; g = f; f = e; e = ( d + t )|0; d = c; c = b; b = a;
a = ( t + ( (b & c) ^ ( d & (b ^ c) ) ) + ( b>>>2 ^ b>>>13 ^ b>>>22 ^ b<<30 ^ b<<19 ^ b<<10 ) )|0;
a = ( w15 + a + ( f>>>6 ^ f>>>11 ^ f>>>25 ^ f<<26 ^ f<<21 ^ f<<7 ) + ( h ^ f & (g^h) ) + 0xc19bf174 )|0;
e = ( e + a )|0;
a = ( a + ( (b & c) ^ ( d & (b ^ c) ) ) + ( b>>>2 ^ b>>>13 ^ b>>>22 ^ b<<30 ^ b<<19 ^ b<<10 ) )|0;
// 16
w0 = t = ( ( w1>>>7 ^ w1>>>18 ^ w1>>>3 ^ w1<<25 ^ w1<<14 ) + ( w14>>>17 ^ w14>>>19 ^ w14>>>10 ^ w14<<15 ^ w14<<13 ) + w0 + w9 )|0;
t = ( t + h + ( e>>>6 ^ e>>>11 ^ e>>>25 ^ e<<26 ^ e<<21 ^ e<<7 ) + ( g ^ e & (f^g) ) + 0xe49b69c1 )|0;
h = g; g = f; f = e; e = ( d + t )|0; d = c; c = b; b = a;
a = ( t + ( (b & c) ^ ( d & (b ^ c) ) ) + ( b>>>2 ^ b>>>13 ^ b>>>22 ^ b<<30 ^ b<<19 ^ b<<10 ) )|0;
w0 = ( ( w1>>>7 ^ w1>>>18 ^ w1>>>3 ^ w1<<25 ^ w1<<14 ) + ( w14>>>17 ^ w14>>>19 ^ w14>>>10 ^ w14<<15 ^ w14<<13 ) + w0 + w9 )|0;
h = ( w0 + h + ( e>>>6 ^ e>>>11 ^ e>>>25 ^ e<<26 ^ e<<21 ^ e<<7 ) + ( g ^ e & (f^g) ) + 0xe49b69c1 )|0;
d = ( d + h )|0;
h = ( h + ( (a & b) ^ ( c & (a ^ b) ) ) + ( a>>>2 ^ a>>>13 ^ a>>>22 ^ a<<30 ^ a<<19 ^ a<<10 ) )|0;
// 17
w1 = t = ( ( w2>>>7 ^ w2>>>18 ^ w2>>>3 ^ w2<<25 ^ w2<<14 ) + ( w15>>>17 ^ w15>>>19 ^ w15>>>10 ^ w15<<15 ^ w15<<13 ) + w1 + w10 )|0;
t = ( t + h + ( e>>>6 ^ e>>>11 ^ e>>>25 ^ e<<26 ^ e<<21 ^ e<<7 ) + ( g ^ e & (f^g) ) + 0xefbe4786 )|0;
h = g; g = f; f = e; e = ( d + t )|0; d = c; c = b; b = a;
a = ( t + ( (b & c) ^ ( d & (b ^ c) ) ) + ( b>>>2 ^ b>>>13 ^ b>>>22 ^ b<<30 ^ b<<19 ^ b<<10 ) )|0;
w1 = ( ( w2>>>7 ^ w2>>>18 ^ w2>>>3 ^ w2<<25 ^ w2<<14 ) + ( w15>>>17 ^ w15>>>19 ^ w15>>>10 ^ w15<<15 ^ w15<<13 ) + w1 + w10 )|0;
g = ( w1 + g + ( d>>>6 ^ d>>>11 ^ d>>>25 ^ d<<26 ^ d<<21 ^ d<<7 ) + ( f ^ d & (e^f) ) + 0xefbe4786 )|0;
c = ( c + g )|0;
g = ( g + ( (h & a) ^ ( b & (h ^ a) ) ) + ( h>>>2 ^ h>>>13 ^ h>>>22 ^ h<<30 ^ h<<19 ^ h<<10 ) )|0;
// 18
w2 = t = ( ( w3>>>7 ^ w3>>>18 ^ w3>>>3 ^ w3<<25 ^ w3<<14 ) + ( w0>>>17 ^ w0>>>19 ^ w0>>>10 ^ w0<<15 ^ w0<<13 ) + w2 + w11 )|0;
t = ( t + h + ( e>>>6 ^ e>>>11 ^ e>>>25 ^ e<<26 ^ e<<21 ^ e<<7 ) + ( g ^ e & (f^g) ) + 0x0fc19dc6 )|0;
h = g; g = f; f = e; e = ( d + t )|0; d = c; c = b; b = a;
a = ( t + ( (b & c) ^ ( d & (b ^ c) ) ) + ( b>>>2 ^ b>>>13 ^ b>>>22 ^ b<<30 ^ b<<19 ^ b<<10 ) )|0;
w2 = ( ( w3>>>7 ^ w3>>>18 ^ w3>>>3 ^ w3<<25 ^ w3<<14 ) + ( w0>>>17 ^ w0>>>19 ^ w0>>>10 ^ w0<<15 ^ w0<<13 ) + w2 + w11 )|0;
f = ( w2 + f + ( c>>>6 ^ c>>>11 ^ c>>>25 ^ c<<26 ^ c<<21 ^ c<<7 ) + ( e ^ c & (d^e) ) + 0x0fc19dc6 )|0;
b = ( b + f )|0;
f = ( f + ( (g & h) ^ ( a & (g ^ h) ) ) + ( g>>>2 ^ g>>>13 ^ g>>>22 ^ g<<30 ^ g<<19 ^ g<<10 ) )|0;
// 19
w3 = t = ( ( w4>>>7 ^ w4>>>18 ^ w4>>>3 ^ w4<<25 ^ w4<<14 ) + ( w1>>>17 ^ w1>>>19 ^ w1>>>10 ^ w1<<15 ^ w1<<13 ) + w3 + w12 )|0;
t = ( t + h + ( e>>>6 ^ e>>>11 ^ e>>>25 ^ e<<26 ^ e<<21 ^ e<<7 ) + ( g ^ e & (f^g) ) + 0x240ca1cc )|0;
h = g; g = f; f = e; e = ( d + t )|0; d = c; c = b; b = a;
a = ( t + ( (b & c) ^ ( d & (b ^ c) ) ) + ( b>>>2 ^ b>>>13 ^ b>>>22 ^ b<<30 ^ b<<19 ^ b<<10 ) )|0;
w3 = ( ( w4>>>7 ^ w4>>>18 ^ w4>>>3 ^ w4<<25 ^ w4<<14 ) + ( w1>>>17 ^ w1>>>19 ^ w1>>>10 ^ w1<<15 ^ w1<<13 ) + w3 + w12 )|0;
e = ( w3 + e + ( b>>>6 ^ b>>>11 ^ b>>>25 ^ b<<26 ^ b<<21 ^ b<<7 ) + ( d ^ b & (c^d) ) + 0x240ca1cc )|0;
a = ( a + e )|0;
e = ( e + ( (f & g) ^ ( h & (f ^ g) ) ) + ( f>>>2 ^ f>>>13 ^ f>>>22 ^ f<<30 ^ f<<19 ^ f<<10 ) )|0;
// 20
w4 = t = ( ( w5>>>7 ^ w5>>>18 ^ w5>>>3 ^ w5<<25 ^ w5<<14 ) + ( w2>>>17 ^ w2>>>19 ^ w2>>>10 ^ w2<<15 ^ w2<<13 ) + w4 + w13 )|0;
t = ( t + h + ( e>>>6 ^ e>>>11 ^ e>>>25 ^ e<<26 ^ e<<21 ^ e<<7 ) + ( g ^ e & (f^g) ) + 0x2de92c6f )|0;
h = g; g = f; f = e; e = ( d + t )|0; d = c; c = b; b = a;
a = ( t + ( (b & c) ^ ( d & (b ^ c) ) ) + ( b>>>2 ^ b>>>13 ^ b>>>22 ^ b<<30 ^ b<<19 ^ b<<10 ) )|0;
w4 = ( ( w5>>>7 ^ w5>>>18 ^ w5>>>3 ^ w5<<25 ^ w5<<14 ) + ( w2>>>17 ^ w2>>>19 ^ w2>>>10 ^ w2<<15 ^ w2<<13 ) + w4 + w13 )|0;
d = ( w4 + d + ( a>>>6 ^ a>>>11 ^ a>>>25 ^ a<<26 ^ a<<21 ^ a<<7 ) + ( c ^ a & (b^c) ) + 0x2de92c6f )|0;
h = ( h + d )|0;
d = ( d + ( (e & f) ^ ( g & (e ^ f) ) ) + ( e>>>2 ^ e>>>13 ^ e>>>22 ^ e<<30 ^ e<<19 ^ e<<10 ) )|0;
// 21
w5 = t = ( ( w6>>>7 ^ w6>>>18 ^ w6>>>3 ^ w6<<25 ^ w6<<14 ) + ( w3>>>17 ^ w3>>>19 ^ w3>>>10 ^ w3<<15 ^ w3<<13 ) + w5 + w14 )|0;
t = ( t + h + ( e>>>6 ^ e>>>11 ^ e>>>25 ^ e<<26 ^ e<<21 ^ e<<7 ) + ( g ^ e & (f^g) ) + 0x4a7484aa )|0;
h = g; g = f; f = e; e = ( d + t )|0; d = c; c = b; b = a;
a = ( t + ( (b & c) ^ ( d & (b ^ c) ) ) + ( b>>>2 ^ b>>>13 ^ b>>>22 ^ b<<30 ^ b<<19 ^ b<<10 ) )|0;
w5 = ( ( w6>>>7 ^ w6>>>18 ^ w6>>>3 ^ w6<<25 ^ w6<<14 ) + ( w3>>>17 ^ w3>>>19 ^ w3>>>10 ^ w3<<15 ^ w3<<13 ) + w5 + w14 )|0;
c = ( w5 + c + ( h>>>6 ^ h>>>11 ^ h>>>25 ^ h<<26 ^ h<<21 ^ h<<7 ) + ( b ^ h & (a^b) ) + 0x4a7484aa )|0;
g = ( g + c )|0;
c = ( c + ( (d & e) ^ ( f & (d ^ e) ) ) + ( d>>>2 ^ d>>>13 ^ d>>>22 ^ d<<30 ^ d<<19 ^ d<<10 ) )|0;
// 22
w6 = t = ( ( w7>>>7 ^ w7>>>18 ^ w7>>>3 ^ w7<<25 ^ w7<<14 ) + ( w4>>>17 ^ w4>>>19 ^ w4>>>10 ^ w4<<15 ^ w4<<13 ) + w6 + w15 )|0;
t = ( t + h + ( e>>>6 ^ e>>>11 ^ e>>>25 ^ e<<26 ^ e<<21 ^ e<<7 ) + ( g ^ e & (f^g) ) + 0x5cb0a9dc )|0;
h = g; g = f; f = e; e = ( d + t )|0; d = c; c = b; b = a;
a = ( t + ( (b & c) ^ ( d & (b ^ c) ) ) + ( b>>>2 ^ b>>>13 ^ b>>>22 ^ b<<30 ^ b<<19 ^ b<<10 ) )|0;
w6 = ( ( w7>>>7 ^ w7>>>18 ^ w7>>>3 ^ w7<<25 ^ w7<<14 ) + ( w4>>>17 ^ w4>>>19 ^ w4>>>10 ^ w4<<15 ^ w4<<13 ) + w6 + w15 )|0;
b = ( w6 + b + ( g>>>6 ^ g>>>11 ^ g>>>25 ^ g<<26 ^ g<<21 ^ g<<7 ) + ( a ^ g & (h^a) ) + 0x5cb0a9dc )|0;
f = ( f + b )|0;
b = ( b + ( (c & d) ^ ( e & (c ^ d) ) ) + ( c>>>2 ^ c>>>13 ^ c>>>22 ^ c<<30 ^ c<<19 ^ c<<10 ) )|0;
// 23
w7 = t = ( ( w8>>>7 ^ w8>>>18 ^ w8>>>3 ^ w8<<25 ^ w8<<14 ) + ( w5>>>17 ^ w5>>>19 ^ w5>>>10 ^ w5<<15 ^ w5<<13 ) + w7 + w0 )|0;
t = ( t + h + ( e>>>6 ^ e>>>11 ^ e>>>25 ^ e<<26 ^ e<<21 ^ e<<7 ) + ( g ^ e & (f^g) ) + 0x76f988da )|0;
h = g; g = f; f = e; e = ( d + t )|0; d = c; c = b; b = a;
a = ( t + ( (b & c) ^ ( d & (b ^ c) ) ) + ( b>>>2 ^ b>>>13 ^ b>>>22 ^ b<<30 ^ b<<19 ^ b<<10 ) )|0;
w7 = ( ( w8>>>7 ^ w8>>>18 ^ w8>>>3 ^ w8<<25 ^ w8<<14 ) + ( w5>>>17 ^ w5>>>19 ^ w5>>>10 ^ w5<<15 ^ w5<<13 ) + w7 + w0 )|0;
a = ( w7 + a + ( f>>>6 ^ f>>>11 ^ f>>>25 ^ f<<26 ^ f<<21 ^ f<<7 ) + ( h ^ f & (g^h) ) + 0x76f988da )|0;
e = ( e + a )|0;
a = ( a + ( (b & c) ^ ( d & (b ^ c) ) ) + ( b>>>2 ^ b>>>13 ^ b>>>22 ^ b<<30 ^ b<<19 ^ b<<10 ) )|0;
// 24
w8 = t = ( ( w9>>>7 ^ w9>>>18 ^ w9>>>3 ^ w9<<25 ^ w9<<14 ) + ( w6>>>17 ^ w6>>>19 ^ w6>>>10 ^ w6<<15 ^ w6<<13 ) + w8 + w1 )|0;
t = ( t + h + ( e>>>6 ^ e>>>11 ^ e>>>25 ^ e<<26 ^ e<<21 ^ e<<7 ) + ( g ^ e & (f^g) ) + 0x983e5152 )|0;
h = g; g = f; f = e; e = ( d + t )|0; d = c; c = b; b = a;
a = ( t + ( (b & c) ^ ( d & (b ^ c) ) ) + ( b>>>2 ^ b>>>13 ^ b>>>22 ^ b<<30 ^ b<<19 ^ b<<10 ) )|0;
w8 = ( ( w9>>>7 ^ w9>>>18 ^ w9>>>3 ^ w9<<25 ^ w9<<14 ) + ( w6>>>17 ^ w6>>>19 ^ w6>>>10 ^ w6<<15 ^ w6<<13 ) + w8 + w1 )|0;
h = ( w8 + h + ( e>>>6 ^ e>>>11 ^ e>>>25 ^ e<<26 ^ e<<21 ^ e<<7 ) + ( g ^ e & (f^g) ) + 0x983e5152 )|0;
d = ( d + h )|0;
h = ( h + ( (a & b) ^ ( c & (a ^ b) ) ) + ( a>>>2 ^ a>>>13 ^ a>>>22 ^ a<<30 ^ a<<19 ^ a<<10 ) )|0;
// 25
w9 = t = ( ( w10>>>7 ^ w10>>>18 ^ w10>>>3 ^ w10<<25 ^ w10<<14 ) + ( w7>>>17 ^ w7>>>19 ^ w7>>>10 ^ w7<<15 ^ w7<<13 ) + w9 + w2 )|0;
t = ( t + h + ( e>>>6 ^ e>>>11 ^ e>>>25 ^ e<<26 ^ e<<21 ^ e<<7 ) + ( g ^ e & (f^g) ) + 0xa831c66d )|0;
h = g; g = f; f = e; e = ( d + t )|0; d = c; c = b; b = a;
a = ( t + ( (b & c) ^ ( d & (b ^ c) ) ) + ( b>>>2 ^ b>>>13 ^ b>>>22 ^ b<<30 ^ b<<19 ^ b<<10 ) )|0;
w9 = ( ( w10>>>7 ^ w10>>>18 ^ w10>>>3 ^ w10<<25 ^ w10<<14 ) + ( w7>>>17 ^ w7>>>19 ^ w7>>>10 ^ w7<<15 ^ w7<<13 ) + w9 + w2 )|0;
g = ( w9 + g + ( d>>>6 ^ d>>>11 ^ d>>>25 ^ d<<26 ^ d<<21 ^ d<<7 ) + ( f ^ d & (e^f) ) + 0xa831c66d )|0;
c = ( c + g )|0;
g = ( g + ( (h & a) ^ ( b & (h ^ a) ) ) + ( h>>>2 ^ h>>>13 ^ h>>>22 ^ h<<30 ^ h<<19 ^ h<<10 ) )|0;
// 26
w10 = t = ( ( w11>>>7 ^ w11>>>18 ^ w11>>>3 ^ w11<<25 ^ w11<<14 ) + ( w8>>>17 ^ w8>>>19 ^ w8>>>10 ^ w8<<15 ^ w8<<13 ) + w10 + w3 )|0;
t = ( t + h + ( e>>>6 ^ e>>>11 ^ e>>>25 ^ e<<26 ^ e<<21 ^ e<<7 ) + ( g ^ e & (f^g) ) + 0xb00327c8 )|0;
h = g; g = f; f = e; e = ( d + t )|0; d = c; c = b; b = a;
a = ( t + ( (b & c) ^ ( d & (b ^ c) ) ) + ( b>>>2 ^ b>>>13 ^ b>>>22 ^ b<<30 ^ b<<19 ^ b<<10 ) )|0;
w10 = ( ( w11>>>7 ^ w11>>>18 ^ w11>>>3 ^ w11<<25 ^ w11<<14 ) + ( w8>>>17 ^ w8>>>19 ^ w8>>>10 ^ w8<<15 ^ w8<<13 ) + w10 + w3 )|0;
f = ( w10 + f + ( c>>>6 ^ c>>>11 ^ c>>>25 ^ c<<26 ^ c<<21 ^ c<<7 ) + ( e ^ c & (d^e) ) + 0xb00327c8 )|0;
b = ( b + f )|0;
f = ( f + ( (g & h) ^ ( a & (g ^ h) ) ) + ( g>>>2 ^ g>>>13 ^ g>>>22 ^ g<<30 ^ g<<19 ^ g<<10 ) )|0;
// 27
w11 = t = ( ( w12>>>7 ^ w12>>>18 ^ w12>>>3 ^ w12<<25 ^ w12<<14 ) + ( w9>>>17 ^ w9>>>19 ^ w9>>>10 ^ w9<<15 ^ w9<<13 ) + w11 + w4 )|0;
t = ( t + h + ( e>>>6 ^ e>>>11 ^ e>>>25 ^ e<<26 ^ e<<21 ^ e<<7 ) + ( g ^ e & (f^g) ) + 0xbf597fc7 )|0;
h = g; g = f; f = e; e = ( d + t )|0; d = c; c = b; b = a;
a = ( t + ( (b & c) ^ ( d & (b ^ c) ) ) + ( b>>>2 ^ b>>>13 ^ b>>>22 ^ b<<30 ^ b<<19 ^ b<<10 ) )|0;
w11 = ( ( w12>>>7 ^ w12>>>18 ^ w12>>>3 ^ w12<<25 ^ w12<<14 ) + ( w9>>>17 ^ w9>>>19 ^ w9>>>10 ^ w9<<15 ^ w9<<13 ) + w11 + w4 )|0;
e = ( w11 + e + ( b>>>6 ^ b>>>11 ^ b>>>25 ^ b<<26 ^ b<<21 ^ b<<7 ) + ( d ^ b & (c^d) ) + 0xbf597fc7 )|0;
a = ( a + e )|0;
e = ( e + ( (f & g) ^ ( h & (f ^ g) ) ) + ( f>>>2 ^ f>>>13 ^ f>>>22 ^ f<<30 ^ f<<19 ^ f<<10 ) )|0;
// 28
w12 = t = ( ( w13>>>7 ^ w13>>>18 ^ w13>>>3 ^ w13<<25 ^ w13<<14 ) + ( w10>>>17 ^ w10>>>19 ^ w10>>>10 ^ w10<<15 ^ w10<<13 ) + w12 + w5 )|0;
t = ( t + h + ( e>>>6 ^ e>>>11 ^ e>>>25 ^ e<<26 ^ e<<21 ^ e<<7 ) + ( g ^ e & (f^g) ) + 0xc6e00bf3 )|0;
h = g; g = f; f = e; e = ( d + t )|0; d = c; c = b; b = a;
a = ( t + ( (b & c) ^ ( d & (b ^ c) ) ) + ( b>>>2 ^ b>>>13 ^ b>>>22 ^ b<<30 ^ b<<19 ^ b<<10 ) )|0;
w12 = ( ( w13>>>7 ^ w13>>>18 ^ w13>>>3 ^ w13<<25 ^ w13<<14 ) + ( w10>>>17 ^ w10>>>19 ^ w10>>>10 ^ w10<<15 ^ w10<<13 ) + w12 + w5 )|0;
d = ( w12 + d + ( a>>>6 ^ a>>>11 ^ a>>>25 ^ a<<26 ^ a<<21 ^ a<<7 ) + ( c ^ a & (b^c) ) + 0xc6e00bf3 )|0;
h = ( h + d )|0;
d = ( d + ( (e & f) ^ ( g & (e ^ f) ) ) + ( e>>>2 ^ e>>>13 ^ e>>>22 ^ e<<30 ^ e<<19 ^ e<<10 ) )|0;
// 29
w13 = t = ( ( w14>>>7 ^ w14>>>18 ^ w14>>>3 ^ w14<<25 ^ w14<<14 ) + ( w11>>>17 ^ w11>>>19 ^ w11>>>10 ^ w11<<15 ^ w11<<13 ) + w13 + w6 )|0;
t = ( t + h + ( e>>>6 ^ e>>>11 ^ e>>>25 ^ e<<26 ^ e<<21 ^ e<<7 ) + ( g ^ e & (f^g) ) + 0xd5a79147 )|0;
h = g; g = f; f = e; e = ( d + t )|0; d = c; c = b; b = a;
a = ( t + ( (b & c) ^ ( d & (b ^ c) ) ) + ( b>>>2 ^ b>>>13 ^ b>>>22 ^ b<<30 ^ b<<19 ^ b<<10 ) )|0;
w13 = ( ( w14>>>7 ^ w14>>>18 ^ w14>>>3 ^ w14<<25 ^ w14<<14 ) + ( w11>>>17 ^ w11>>>19 ^ w11>>>10 ^ w11<<15 ^ w11<<13 ) + w13 + w6 )|0;
c = ( w13 + c + ( h>>>6 ^ h>>>11 ^ h>>>25 ^ h<<26 ^ h<<21 ^ h<<7 ) + ( b ^ h & (a^b) ) + 0xd5a79147 )|0;
g = ( g + c )|0;
c = ( c + ( (d & e) ^ ( f & (d ^ e) ) ) + ( d>>>2 ^ d>>>13 ^ d>>>22 ^ d<<30 ^ d<<19 ^ d<<10 ) )|0;
// 30
w14 = t = ( ( w15>>>7 ^ w15>>>18 ^ w15>>>3 ^ w15<<25 ^ w15<<14 ) + ( w12>>>17 ^ w12>>>19 ^ w12>>>10 ^ w12<<15 ^ w12<<13 ) + w14 + w7 )|0;
t = ( t + h + ( e>>>6 ^ e>>>11 ^ e>>>25 ^ e<<26 ^ e<<21 ^ e<<7 ) + ( g ^ e & (f^g) ) + 0x06ca6351 )|0;
h = g; g = f; f = e; e = ( d + t )|0; d = c; c = b; b = a;
a = ( t + ( (b & c) ^ ( d & (b ^ c) ) ) + ( b>>>2 ^ b>>>13 ^ b>>>22 ^ b<<30 ^ b<<19 ^ b<<10 ) )|0;
w14 = ( ( w15>>>7 ^ w15>>>18 ^ w15>>>3 ^ w15<<25 ^ w15<<14 ) + ( w12>>>17 ^ w12>>>19 ^ w12>>>10 ^ w12<<15 ^ w12<<13 ) + w14 + w7 )|0;
b = ( w14 + b + ( g>>>6 ^ g>>>11 ^ g>>>25 ^ g<<26 ^ g<<21 ^ g<<7 ) + ( a ^ g & (h^a) ) + 0x06ca6351 )|0;
f = ( f + b )|0;
b = ( b + ( (c & d) ^ ( e & (c ^ d) ) ) + ( c>>>2 ^ c>>>13 ^ c>>>22 ^ c<<30 ^ c<<19 ^ c<<10 ) )|0;
// 31
w15 = t = ( ( w0>>>7 ^ w0>>>18 ^ w0>>>3 ^ w0<<25 ^ w0<<14 ) + ( w13>>>17 ^ w13>>>19 ^ w13>>>10 ^ w13<<15 ^ w13<<13 ) + w15 + w8 )|0;
t = ( t + h + ( e>>>6 ^ e>>>11 ^ e>>>25 ^ e<<26 ^ e<<21 ^ e<<7 ) + ( g ^ e & (f^g) ) + 0x14292967 )|0;
h = g; g = f; f = e; e = ( d + t )|0; d = c; c = b; b = a;
a = ( t + ( (b & c) ^ ( d & (b ^ c) ) ) + ( b>>>2 ^ b>>>13 ^ b>>>22 ^ b<<30 ^ b<<19 ^ b<<10 ) )|0;
w15 = ( ( w0>>>7 ^ w0>>>18 ^ w0>>>3 ^ w0<<25 ^ w0<<14 ) + ( w13>>>17 ^ w13>>>19 ^ w13>>>10 ^ w13<<15 ^ w13<<13 ) + w15 + w8 )|0;
a = ( w15 + a + ( f>>>6 ^ f>>>11 ^ f>>>25 ^ f<<26 ^ f<<21 ^ f<<7 ) + ( h ^ f & (g^h) ) + 0x14292967 )|0;
e = ( e + a )|0;
a = ( a + ( (b & c) ^ ( d & (b ^ c) ) ) + ( b>>>2 ^ b>>>13 ^ b>>>22 ^ b<<30 ^ b<<19 ^ b<<10 ) )|0;
// 32
w0 = t = ( ( w1>>>7 ^ w1>>>18 ^ w1>>>3 ^ w1<<25 ^ w1<<14 ) + ( w14>>>17 ^ w14>>>19 ^ w14>>>10 ^ w14<<15 ^ w14<<13 ) + w0 + w9 )|0;
t = ( t + h + ( e>>>6 ^ e>>>11 ^ e>>>25 ^ e<<26 ^ e<<21 ^ e<<7 ) + ( g ^ e & (f^g) ) + 0x27b70a85 )|0;
h = g; g = f; f = e; e = ( d + t )|0; d = c; c = b; b = a;
a = ( t + ( (b & c) ^ ( d & (b ^ c) ) ) + ( b>>>2 ^ b>>>13 ^ b>>>22 ^ b<<30 ^ b<<19 ^ b<<10 ) )|0;
w0 = ( ( w1>>>7 ^ w1>>>18 ^ w1>>>3 ^ w1<<25 ^ w1<<14 ) + ( w14>>>17 ^ w14>>>19 ^ w14>>>10 ^ w14<<15 ^ w14<<13 ) + w0 + w9 )|0;
h = ( w0 + h + ( e>>>6 ^ e>>>11 ^ e>>>25 ^ e<<26 ^ e<<21 ^ e<<7 ) + ( g ^ e & (f^g) ) + 0x27b70a85 )|0;
d = ( d + h )|0;
h = ( h + ( (a & b) ^ ( c & (a ^ b) ) ) + ( a>>>2 ^ a>>>13 ^ a>>>22 ^ a<<30 ^ a<<19 ^ a<<10 ) )|0;
// 33
w1 = t = ( ( w2>>>7 ^ w2>>>18 ^ w2>>>3 ^ w2<<25 ^ w2<<14 ) + ( w15>>>17 ^ w15>>>19 ^ w15>>>10 ^ w15<<15 ^ w15<<13 ) + w1 + w10 )|0;
t = ( t + h + ( e>>>6 ^ e>>>11 ^ e>>>25 ^ e<<26 ^ e<<21 ^ e<<7 ) + ( g ^ e & (f^g) ) + 0x2e1b2138 )|0;
h = g; g = f; f = e; e = ( d + t )|0; d = c; c = b; b = a;
a = ( t + ( (b & c) ^ ( d & (b ^ c) ) ) + ( b>>>2 ^ b>>>13 ^ b>>>22 ^ b<<30 ^ b<<19 ^ b<<10 ) )|0;
w1 = ( ( w2>>>7 ^ w2>>>18 ^ w2>>>3 ^ w2<<25 ^ w2<<14 ) + ( w15>>>17 ^ w15>>>19 ^ w15>>>10 ^ w15<<15 ^ w15<<13 ) + w1 + w10 )|0;
g = ( w1 + g + ( d>>>6 ^ d>>>11 ^ d>>>25 ^ d<<26 ^ d<<21 ^ d<<7 ) + ( f ^ d & (e^f) ) + 0x2e1b2138 )|0;
c = ( c + g )|0;
g = ( g + ( (h & a) ^ ( b & (h ^ a) ) ) + ( h>>>2 ^ h>>>13 ^ h>>>22 ^ h<<30 ^ h<<19 ^ h<<10 ) )|0;
// 34
w2 = t = ( ( w3>>>7 ^ w3>>>18 ^ w3>>>3 ^ w3<<25 ^ w3<<14 ) + ( w0>>>17 ^ w0>>>19 ^ w0>>>10 ^ w0<<15 ^ w0<<13 ) + w2 + w11 )|0;
t = ( t + h + ( e>>>6 ^ e>>>11 ^ e>>>25 ^ e<<26 ^ e<<21 ^ e<<7 ) + ( g ^ e & (f^g) ) + 0x4d2c6dfc )|0;
h = g; g = f; f = e; e = ( d + t )|0; d = c; c = b; b = a;
a = ( t + ( (b & c) ^ ( d & (b ^ c) ) ) + ( b>>>2 ^ b>>>13 ^ b>>>22 ^ b<<30 ^ b<<19 ^ b<<10 ) )|0;
w2 = ( ( w3>>>7 ^ w3>>>18 ^ w3>>>3 ^ w3<<25 ^ w3<<14 ) + ( w0>>>17 ^ w0>>>19 ^ w0>>>10 ^ w0<<15 ^ w0<<13 ) + w2 + w11 )|0;
f = ( w2 + f + ( c>>>6 ^ c>>>11 ^ c>>>25 ^ c<<26 ^ c<<21 ^ c<<7 ) + ( e ^ c & (d^e) ) + 0x4d2c6dfc )|0;
b = ( b + f )|0;
f = ( f + ( (g & h) ^ ( a & (g ^ h) ) ) + ( g>>>2 ^ g>>>13 ^ g>>>22 ^ g<<30 ^ g<<19 ^ g<<10 ) )|0;
// 35
w3 = t = ( ( w4>>>7 ^ w4>>>18 ^ w4>>>3 ^ w4<<25 ^ w4<<14 ) + ( w1>>>17 ^ w1>>>19 ^ w1>>>10 ^ w1<<15 ^ w1<<13 ) + w3 + w12 )|0;
t = ( t + h + ( e>>>6 ^ e>>>11 ^ e>>>25 ^ e<<26 ^ e<<21 ^ e<<7 ) + ( g ^ e & (f^g) ) + 0x53380d13 )|0;
h = g; g = f; f = e; e = ( d + t )|0; d = c; c = b; b = a;
a = ( t + ( (b & c) ^ ( d & (b ^ c) ) ) + ( b>>>2 ^ b>>>13 ^ b>>>22 ^ b<<30 ^ b<<19 ^ b<<10 ) )|0;
w3 = ( ( w4>>>7 ^ w4>>>18 ^ w4>>>3 ^ w4<<25 ^ w4<<14 ) + ( w1>>>17 ^ w1>>>19 ^ w1>>>10 ^ w1<<15 ^ w1<<13 ) + w3 + w12 )|0;
e = ( w3 + e + ( b>>>6 ^ b>>>11 ^ b>>>25 ^ b<<26 ^ b<<21 ^ b<<7 ) + ( d ^ b & (c^d) ) + 0x53380d13 )|0;
a = ( a + e )|0;
e = ( e + ( (f & g) ^ ( h & (f ^ g) ) ) + ( f>>>2 ^ f>>>13 ^ f>>>22 ^ f<<30 ^ f<<19 ^ f<<10 ) )|0;
// 36
w4 = t = ( ( w5>>>7 ^ w5>>>18 ^ w5>>>3 ^ w5<<25 ^ w5<<14 ) + ( w2>>>17 ^ w2>>>19 ^ w2>>>10 ^ w2<<15 ^ w2<<13 ) + w4 + w13 )|0;
t = ( t + h + ( e>>>6 ^ e>>>11 ^ e>>>25 ^ e<<26 ^ e<<21 ^ e<<7 ) + ( g ^ e & (f^g) ) + 0x650a7354 )|0;
h = g; g = f; f = e; e = ( d + t )|0; d = c; c = b; b = a;
a = ( t + ( (b & c) ^ ( d & (b ^ c) ) ) + ( b>>>2 ^ b>>>13 ^ b>>>22 ^ b<<30 ^ b<<19 ^ b<<10 ) )|0;
w4 = ( ( w5>>>7 ^ w5>>>18 ^ w5>>>3 ^ w5<<25 ^ w5<<14 ) + ( w2>>>17 ^ w2>>>19 ^ w2>>>10 ^ w2<<15 ^ w2<<13 ) + w4 + w13 )|0;
d = ( w4 + d + ( a>>>6 ^ a>>>11 ^ a>>>25 ^ a<<26 ^ a<<21 ^ a<<7 ) + ( c ^ a & (b^c) ) + 0x650a7354 )|0;
h = ( h + d )|0;
d = ( d + ( (e & f) ^ ( g & (e ^ f) ) ) + ( e>>>2 ^ e>>>13 ^ e>>>22 ^ e<<30 ^ e<<19 ^ e<<10 ) )|0;
// 37
w5 = t = ( ( w6>>>7 ^ w6>>>18 ^ w6>>>3 ^ w6<<25 ^ w6<<14 ) + ( w3>>>17 ^ w3>>>19 ^ w3>>>10 ^ w3<<15 ^ w3<<13 ) + w5 + w14 )|0;
t = ( t + h + ( e>>>6 ^ e>>>11 ^ e>>>25 ^ e<<26 ^ e<<21 ^ e<<7 ) + ( g ^ e & (f^g) ) + 0x766a0abb )|0;
h = g; g = f; f = e; e = ( d + t )|0; d = c; c = b; b = a;
a = ( t + ( (b & c) ^ ( d & (b ^ c) ) ) + ( b>>>2 ^ b>>>13 ^ b>>>22 ^ b<<30 ^ b<<19 ^ b<<10 ) )|0;
w5 = ( ( w6>>>7 ^ w6>>>18 ^ w6>>>3 ^ w6<<25 ^ w6<<14 ) + ( w3>>>17 ^ w3>>>19 ^ w3>>>10 ^ w3<<15 ^ w3<<13 ) + w5 + w14 )|0;
c = ( w5 + c + ( h>>>6 ^ h>>>11 ^ h>>>25 ^ h<<26 ^ h<<21 ^ h<<7 ) + ( b ^ h & (a^b) ) + 0x766a0abb )|0;
g = ( g + c )|0;
c = ( c + ( (d & e) ^ ( f & (d ^ e) ) ) + ( d>>>2 ^ d>>>13 ^ d>>>22 ^ d<<30 ^ d<<19 ^ d<<10 ) )|0;
// 38
w6 = t = ( ( w7>>>7 ^ w7>>>18 ^ w7>>>3 ^ w7<<25 ^ w7<<14 ) + ( w4>>>17 ^ w4>>>19 ^ w4>>>10 ^ w4<<15 ^ w4<<13 ) + w6 + w15 )|0;
t = ( t + h + ( e>>>6 ^ e>>>11 ^ e>>>25 ^ e<<26 ^ e<<21 ^ e<<7 ) + ( g ^ e & (f^g) ) + 0x81c2c92e )|0;
h = g; g = f; f = e; e = ( d + t )|0; d = c; c = b; b = a;
a = ( t + ( (b & c) ^ ( d & (b ^ c) ) ) + ( b>>>2 ^ b>>>13 ^ b>>>22 ^ b<<30 ^ b<<19 ^ b<<10 ) )|0;
w6 = ( ( w7>>>7 ^ w7>>>18 ^ w7>>>3 ^ w7<<25 ^ w7<<14 ) + ( w4>>>17 ^ w4>>>19 ^ w4>>>10 ^ w4<<15 ^ w4<<13 ) + w6 + w15 )|0;
b = ( w6 + b + ( g>>>6 ^ g>>>11 ^ g>>>25 ^ g<<26 ^ g<<21 ^ g<<7 ) + ( a ^ g & (h^a) ) + 0x81c2c92e )|0;
f = ( f + b )|0;
b = ( b + ( (c & d) ^ ( e & (c ^ d) ) ) + ( c>>>2 ^ c>>>13 ^ c>>>22 ^ c<<30 ^ c<<19 ^ c<<10 ) )|0;
// 39
w7 = t = ( ( w8>>>7 ^ w8>>>18 ^ w8>>>3 ^ w8<<25 ^ w8<<14 ) + ( w5>>>17 ^ w5>>>19 ^ w5>>>10 ^ w5<<15 ^ w5<<13 ) + w7 + w0 )|0;
t = ( t + h + ( e>>>6 ^ e>>>11 ^ e>>>25 ^ e<<26 ^ e<<21 ^ e<<7 ) + ( g ^ e & (f^g) ) + 0x92722c85 )|0;
h = g; g = f; f = e; e = ( d + t )|0; d = c; c = b; b = a;
a = ( t + ( (b & c) ^ ( d & (b ^ c) ) ) + ( b>>>2 ^ b>>>13 ^ b>>>22 ^ b<<30 ^ b<<19 ^ b<<10 ) )|0;
w7 = ( ( w8>>>7 ^ w8>>>18 ^ w8>>>3 ^ w8<<25 ^ w8<<14 ) + ( w5>>>17 ^ w5>>>19 ^ w5>>>10 ^ w5<<15 ^ w5<<13 ) + w7 + w0 )|0;
a = ( w7 + a + ( f>>>6 ^ f>>>11 ^ f>>>25 ^ f<<26 ^ f<<21 ^ f<<7 ) + ( h ^ f & (g^h) ) + 0x92722c85 )|0;
e = ( e + a )|0;
a = ( a + ( (b & c) ^ ( d & (b ^ c) ) ) + ( b>>>2 ^ b>>>13 ^ b>>>22 ^ b<<30 ^ b<<19 ^ b<<10 ) )|0;
// 40
w8 = t = ( ( w9>>>7 ^ w9>>>18 ^ w9>>>3 ^ w9<<25 ^ w9<<14 ) + ( w6>>>17 ^ w6>>>19 ^ w6>>>10 ^ w6<<15 ^ w6<<13 ) + w8 + w1 )|0;
t = ( t + h + ( e>>>6 ^ e>>>11 ^ e>>>25 ^ e<<26 ^ e<<21 ^ e<<7 ) + ( g ^ e & (f^g) ) + 0xa2bfe8a1 )|0;
h = g; g = f; f = e; e = ( d + t )|0; d = c; c = b; b = a;
a = ( t + ( (b & c) ^ ( d & (b ^ c) ) ) + ( b>>>2 ^ b>>>13 ^ b>>>22 ^ b<<30 ^ b<<19 ^ b<<10 ) )|0;
w8 = ( ( w9>>>7 ^ w9>>>18 ^ w9>>>3 ^ w9<<25 ^ w9<<14 ) + ( w6>>>17 ^ w6>>>19 ^ w6>>>10 ^ w6<<15 ^ w6<<13 ) + w8 + w1 )|0;
h = ( w8 + h + ( e>>>6 ^ e>>>11 ^ e>>>25 ^ e<<26 ^ e<<21 ^ e<<7 ) + ( g ^ e & (f^g) ) + 0xa2bfe8a1 )|0;
d = ( d + h )|0;
h = ( h + ( (a & b) ^ ( c & (a ^ b) ) ) + ( a>>>2 ^ a>>>13 ^ a>>>22 ^ a<<30 ^ a<<19 ^ a<<10 ) )|0;
// 41
w9 = t = ( ( w10>>>7 ^ w10>>>18 ^ w10>>>3 ^ w10<<25 ^ w10<<14 ) + ( w7>>>17 ^ w7>>>19 ^ w7>>>10 ^ w7<<15 ^ w7<<13 ) + w9 + w2 )|0;
t = ( t + h + ( e>>>6 ^ e>>>11 ^ e>>>25 ^ e<<26 ^ e<<21 ^ e<<7 ) + ( g ^ e & (f^g) ) + 0xa81a664b )|0;
h = g; g = f; f = e; e = ( d + t )|0; d = c; c = b; b = a;
a = ( t + ( (b & c) ^ ( d & (b ^ c) ) ) + ( b>>>2 ^ b>>>13 ^ b>>>22 ^ b<<30 ^ b<<19 ^ b<<10 ) )|0;
w9 = ( ( w10>>>7 ^ w10>>>18 ^ w10>>>3 ^ w10<<25 ^ w10<<14 ) + ( w7>>>17 ^ w7>>>19 ^ w7>>>10 ^ w7<<15 ^ w7<<13 ) + w9 + w2 )|0;
g = ( w9 + g + ( d>>>6 ^ d>>>11 ^ d>>>25 ^ d<<26 ^ d<<21 ^ d<<7 ) + ( f ^ d & (e^f) ) + 0xa81a664b )|0;
c = ( c + g )|0;
g = ( g + ( (h & a) ^ ( b & (h ^ a) ) ) + ( h>>>2 ^ h>>>13 ^ h>>>22 ^ h<<30 ^ h<<19 ^ h<<10 ) )|0;
// 42
w10 = t = ( ( w11>>>7 ^ w11>>>18 ^ w11>>>3 ^ w11<<25 ^ w11<<14 ) + ( w8>>>17 ^ w8>>>19 ^ w8>>>10 ^ w8<<15 ^ w8<<13 ) + w10 + w3 )|0;
t = ( t + h + ( e>>>6 ^ e>>>11 ^ e>>>25 ^ e<<26 ^ e<<21 ^ e<<7 ) + ( g ^ e & (f^g) ) + 0xc24b8b70 )|0;
h = g; g = f; f = e; e = ( d + t )|0; d = c; c = b; b = a;
a = ( t + ( (b & c) ^ ( d & (b ^ c) ) ) + ( b>>>2 ^ b>>>13 ^ b>>>22 ^ b<<30 ^ b<<19 ^ b<<10 ) )|0;
w10 = ( ( w11>>>7 ^ w11>>>18 ^ w11>>>3 ^ w11<<25 ^ w11<<14 ) + ( w8>>>17 ^ w8>>>19 ^ w8>>>10 ^ w8<<15 ^ w8<<13 ) + w10 + w3 )|0;
f = ( w10 + f + ( c>>>6 ^ c>>>11 ^ c>>>25 ^ c<<26 ^ c<<21 ^ c<<7 ) + ( e ^ c & (d^e) ) + 0xc24b8b70 )|0;
b = ( b + f )|0;
f = ( f + ( (g & h) ^ ( a & (g ^ h) ) ) + ( g>>>2 ^ g>>>13 ^ g>>>22 ^ g<<30 ^ g<<19 ^ g<<10 ) )|0;
// 43
w11 = t = ( ( w12>>>7 ^ w12>>>18 ^ w12>>>3 ^ w12<<25 ^ w12<<14 ) + ( w9>>>17 ^ w9>>>19 ^ w9>>>10 ^ w9<<15 ^ w9<<13 ) + w11 + w4 )|0;
t = ( t + h + ( e>>>6 ^ e>>>11 ^ e>>>25 ^ e<<26 ^ e<<21 ^ e<<7 ) + ( g ^ e & (f^g) ) + 0xc76c51a3 )|0;
h = g; g = f; f = e; e = ( d + t )|0; d = c; c = b; b = a;
a = ( t + ( (b & c) ^ ( d & (b ^ c) ) ) + ( b>>>2 ^ b>>>13 ^ b>>>22 ^ b<<30 ^ b<<19 ^ b<<10 ) )|0;
w11 = ( ( w12>>>7 ^ w12>>>18 ^ w12>>>3 ^ w12<<25 ^ w12<<14 ) + ( w9>>>17 ^ w9>>>19 ^ w9>>>10 ^ w9<<15 ^ w9<<13 ) + w11 + w4 )|0;
e = ( w11 + e + ( b>>>6 ^ b>>>11 ^ b>>>25 ^ b<<26 ^ b<<21 ^ b<<7 ) + ( d ^ b & (c^d) ) + 0xc76c51a3 )|0;
a = ( a + e )|0;
e = ( e + ( (f & g) ^ ( h & (f ^ g) ) ) + ( f>>>2 ^ f>>>13 ^ f>>>22 ^ f<<30 ^ f<<19 ^ f<<10 ) )|0;
// 44
w12 = t = ( ( w13>>>7 ^ w13>>>18 ^ w13>>>3 ^ w13<<25 ^ w13<<14 ) + ( w10>>>17 ^ w10>>>19 ^ w10>>>10 ^ w10<<15 ^ w10<<13 ) + w12 + w5 )|0;
t = ( t + h + ( e>>>6 ^ e>>>11 ^ e>>>25 ^ e<<26 ^ e<<21 ^ e<<7 ) + ( g ^ e & (f^g) ) + 0xd192e819 )|0;
h = g; g = f; f = e; e = ( d + t )|0; d = c; c = b; b = a;
a = ( t + ( (b & c) ^ ( d & (b ^ c) ) ) + ( b>>>2 ^ b>>>13 ^ b>>>22 ^ b<<30 ^ b<<19 ^ b<<10 ) )|0;
w12 = ( ( w13>>>7 ^ w13>>>18 ^ w13>>>3 ^ w13<<25 ^ w13<<14 ) + ( w10>>>17 ^ w10>>>19 ^ w10>>>10 ^ w10<<15 ^ w10<<13 ) + w12 + w5 )|0;
d = ( w12 + d + ( a>>>6 ^ a>>>11 ^ a>>>25 ^ a<<26 ^ a<<21 ^ a<<7 ) + ( c ^ a & (b^c) ) + 0xd192e819 )|0;
h = ( h + d )|0;
d = ( d + ( (e & f) ^ ( g & (e ^ f) ) ) + ( e>>>2 ^ e>>>13 ^ e>>>22 ^ e<<30 ^ e<<19 ^ e<<10 ) )|0;
// 45
w13 = t = ( ( w14>>>7 ^ w14>>>18 ^ w14>>>3 ^ w14<<25 ^ w14<<14 ) + ( w11>>>17 ^ w11>>>19 ^ w11>>>10 ^ w11<<15 ^ w11<<13 ) + w13 + w6 )|0;
t = ( t + h + ( e>>>6 ^ e>>>11 ^ e>>>25 ^ e<<26 ^ e<<21 ^ e<<7 ) + ( g ^ e & (f^g) ) + 0xd6990624 )|0;
h = g; g = f; f = e; e = ( d + t )|0; d = c; c = b; b = a;
a = ( t + ( (b & c) ^ ( d & (b ^ c) ) ) + ( b>>>2 ^ b>>>13 ^ b>>>22 ^ b<<30 ^ b<<19 ^ b<<10 ) )|0;
w13 = ( ( w14>>>7 ^ w14>>>18 ^ w14>>>3 ^ w14<<25 ^ w14<<14 ) + ( w11>>>17 ^ w11>>>19 ^ w11>>>10 ^ w11<<15 ^ w11<<13 ) + w13 + w6 )|0;
c = ( w13 + c + ( h>>>6 ^ h>>>11 ^ h>>>25 ^ h<<26 ^ h<<21 ^ h<<7 ) + ( b ^ h & (a^b) ) + 0xd6990624 )|0;
g = ( g + c )|0;
c = ( c + ( (d & e) ^ ( f & (d ^ e) ) ) + ( d>>>2 ^ d>>>13 ^ d>>>22 ^ d<<30 ^ d<<19 ^ d<<10 ) )|0;
// 46
w14 = t = ( ( w15>>>7 ^ w15>>>18 ^ w15>>>3 ^ w15<<25 ^ w15<<14 ) + ( w12>>>17 ^ w12>>>19 ^ w12>>>10 ^ w12<<15 ^ w12<<13 ) + w14 + w7 )|0;
t = ( t + h + ( e>>>6 ^ e>>>11 ^ e>>>25 ^ e<<26 ^ e<<21 ^ e<<7 ) + ( g ^ e & (f^g) ) + 0xf40e3585 )|0;
h = g; g = f; f = e; e = ( d + t )|0; d = c; c = b; b = a;
a = ( t + ( (b & c) ^ ( d & (b ^ c) ) ) + ( b>>>2 ^ b>>>13 ^ b>>>22 ^ b<<30 ^ b<<19 ^ b<<10 ) )|0;
w14 = ( ( w15>>>7 ^ w15>>>18 ^ w15>>>3 ^ w15<<25 ^ w15<<14 ) + ( w12>>>17 ^ w12>>>19 ^ w12>>>10 ^ w12<<15 ^ w12<<13 ) + w14 + w7 )|0;
b = ( w14 + b + ( g>>>6 ^ g>>>11 ^ g>>>25 ^ g<<26 ^ g<<21 ^ g<<7 ) + ( a ^ g & (h^a) ) + 0xf40e3585 )|0;
f = ( f + b )|0;
b = ( b + ( (c & d) ^ ( e & (c ^ d) ) ) + ( c>>>2 ^ c>>>13 ^ c>>>22 ^ c<<30 ^ c<<19 ^ c<<10 ) )|0;
// 47
w15 = t = ( ( w0>>>7 ^ w0>>>18 ^ w0>>>3 ^ w0<<25 ^ w0<<14 ) + ( w13>>>17 ^ w13>>>19 ^ w13>>>10 ^ w13<<15 ^ w13<<13 ) + w15 + w8 )|0;
t = ( t + h + ( e>>>6 ^ e>>>11 ^ e>>>25 ^ e<<26 ^ e<<21 ^ e<<7 ) + ( g ^ e & (f^g) ) + 0x106aa070 )|0;
h = g; g = f; f = e; e = ( d + t )|0; d = c; c = b; b = a;
a = ( t + ( (b & c) ^ ( d & (b ^ c) ) ) + ( b>>>2 ^ b>>>13 ^ b>>>22 ^ b<<30 ^ b<<19 ^ b<<10 ) )|0;
w15 = ( ( w0>>>7 ^ w0>>>18 ^ w0>>>3 ^ w0<<25 ^ w0<<14 ) + ( w13>>>17 ^ w13>>>19 ^ w13>>>10 ^ w13<<15 ^ w13<<13 ) + w15 + w8 )|0;
a = ( w15 + a + ( f>>>6 ^ f>>>11 ^ f>>>25 ^ f<<26 ^ f<<21 ^ f<<7 ) + ( h ^ f & (g^h) ) + 0x106aa070 )|0;
e = ( e + a )|0;
a = ( a + ( (b & c) ^ ( d & (b ^ c) ) ) + ( b>>>2 ^ b>>>13 ^ b>>>22 ^ b<<30 ^ b<<19 ^ b<<10 ) )|0;
// 48
w0 = t = ( ( w1>>>7 ^ w1>>>18 ^ w1>>>3 ^ w1<<25 ^ w1<<14 ) + ( w14>>>17 ^ w14>>>19 ^ w14>>>10 ^ w14<<15 ^ w14<<13 ) + w0 + w9 )|0;
t = ( t + h + ( e>>>6 ^ e>>>11 ^ e>>>25 ^ e<<26 ^ e<<21 ^ e<<7 ) + ( g ^ e & (f^g) ) + 0x19a4c116 )|0;
h = g; g = f; f = e; e = ( d + t )|0; d = c; c = b; b = a;
a = ( t + ( (b & c) ^ ( d & (b ^ c) ) ) + ( b>>>2 ^ b>>>13 ^ b>>>22 ^ b<<30 ^ b<<19 ^ b<<10 ) )|0;
w0 = ( ( w1>>>7 ^ w1>>>18 ^ w1>>>3 ^ w1<<25 ^ w1<<14 ) + ( w14>>>17 ^ w14>>>19 ^ w14>>>10 ^ w14<<15 ^ w14<<13 ) + w0 + w9 )|0;
h = ( w0 + h + ( e>>>6 ^ e>>>11 ^ e>>>25 ^ e<<26 ^ e<<21 ^ e<<7 ) + ( g ^ e & (f^g) ) + 0x19a4c116 )|0;
d = ( d + h )|0;
h = ( h + ( (a & b) ^ ( c & (a ^ b) ) ) + ( a>>>2 ^ a>>>13 ^ a>>>22 ^ a<<30 ^ a<<19 ^ a<<10 ) )|0;
// 49
w1 = t = ( ( w2>>>7 ^ w2>>>18 ^ w2>>>3 ^ w2<<25 ^ w2<<14 ) + ( w15>>>17 ^ w15>>>19 ^ w15>>>10 ^ w15<<15 ^ w15<<13 ) + w1 + w10 )|0;
t = ( t + h + ( e>>>6 ^ e>>>11 ^ e>>>25 ^ e<<26 ^ e<<21 ^ e<<7 ) + ( g ^ e & (f^g) ) + 0x1e376c08 )|0;
h = g; g = f; f = e; e = ( d + t )|0; d = c; c = b; b = a;
a = ( t + ( (b & c) ^ ( d & (b ^ c) ) ) + ( b>>>2 ^ b>>>13 ^ b>>>22 ^ b<<30 ^ b<<19 ^ b<<10 ) )|0;
w1 = ( ( w2>>>7 ^ w2>>>18 ^ w2>>>3 ^ w2<<25 ^ w2<<14 ) + ( w15>>>17 ^ w15>>>19 ^ w15>>>10 ^ w15<<15 ^ w15<<13 ) + w1 + w10 )|0;
g = ( w1 + g + ( d>>>6 ^ d>>>11 ^ d>>>25 ^ d<<26 ^ d<<21 ^ d<<7 ) + ( f ^ d & (e^f) ) + 0x1e376c08 )|0;
c = ( c + g )|0;
g = ( g + ( (h & a) ^ ( b & (h ^ a) ) ) + ( h>>>2 ^ h>>>13 ^ h>>>22 ^ h<<30 ^ h<<19 ^ h<<10 ) )|0;
// 50
w2 = t = ( ( w3>>>7 ^ w3>>>18 ^ w3>>>3 ^ w3<<25 ^ w3<<14 ) + ( w0>>>17 ^ w0>>>19 ^ w0>>>10 ^ w0<<15 ^ w0<<13 ) + w2 + w11 )|0;
t = ( t + h + ( e>>>6 ^ e>>>11 ^ e>>>25 ^ e<<26 ^ e<<21 ^ e<<7 ) + ( g ^ e & (f^g) ) + 0x2748774c )|0;
h = g; g = f; f = e; e = ( d + t )|0; d = c; c = b; b = a;
a = ( t + ( (b & c) ^ ( d & (b ^ c) ) ) + ( b>>>2 ^ b>>>13 ^ b>>>22 ^ b<<30 ^ b<<19 ^ b<<10 ) )|0;
w2 = ( ( w3>>>7 ^ w3>>>18 ^ w3>>>3 ^ w3<<25 ^ w3<<14 ) + ( w0>>>17 ^ w0>>>19 ^ w0>>>10 ^ w0<<15 ^ w0<<13 ) + w2 + w11 )|0;
f = ( w2 + f + ( c>>>6 ^ c>>>11 ^ c>>>25 ^ c<<26 ^ c<<21 ^ c<<7 ) + ( e ^ c & (d^e) ) + 0x2748774c )|0;
b = ( b + f )|0;
f = ( f + ( (g & h) ^ ( a & (g ^ h) ) ) + ( g>>>2 ^ g>>>13 ^ g>>>22 ^ g<<30 ^ g<<19 ^ g<<10 ) )|0;
// 51
w3 = t = ( ( w4>>>7 ^ w4>>>18 ^ w4>>>3 ^ w4<<25 ^ w4<<14 ) + ( w1>>>17 ^ w1>>>19 ^ w1>>>10 ^ w1<<15 ^ w1<<13 ) + w3 + w12 )|0;
t = ( t + h + ( e>>>6 ^ e>>>11 ^ e>>>25 ^ e<<26 ^ e<<21 ^ e<<7 ) + ( g ^ e & (f^g) ) + 0x34b0bcb5 )|0;
h = g; g = f; f = e; e = ( d + t )|0; d = c; c = b; b = a;
a = ( t + ( (b & c) ^ ( d & (b ^ c) ) ) + ( b>>>2 ^ b>>>13 ^ b>>>22 ^ b<<30 ^ b<<19 ^ b<<10 ) )|0;
w3 = ( ( w4>>>7 ^ w4>>>18 ^ w4>>>3 ^ w4<<25 ^ w4<<14 ) + ( w1>>>17 ^ w1>>>19 ^ w1>>>10 ^ w1<<15 ^ w1<<13 ) + w3 + w12 )|0;
e = ( w3 + e + ( b>>>6 ^ b>>>11 ^ b>>>25 ^ b<<26 ^ b<<21 ^ b<<7 ) + ( d ^ b & (c^d) ) + 0x34b0bcb5 )|0;
a = ( a + e )|0;
e = ( e + ( (f & g) ^ ( h & (f ^ g) ) ) + ( f>>>2 ^ f>>>13 ^ f>>>22 ^ f<<30 ^ f<<19 ^ f<<10 ) )|0;
// 52
w4 = t = ( ( w5>>>7 ^ w5>>>18 ^ w5>>>3 ^ w5<<25 ^ w5<<14 ) + ( w2>>>17 ^ w2>>>19 ^ w2>>>10 ^ w2<<15 ^ w2<<13 ) + w4 + w13 )|0;
t = ( t + h + ( e>>>6 ^ e>>>11 ^ e>>>25 ^ e<<26 ^ e<<21 ^ e<<7 ) + ( g ^ e & (f^g) ) + 0x391c0cb3 )|0;
h = g; g = f; f = e; e = ( d + t )|0; d = c; c = b; b = a;
a = ( t + ( (b & c) ^ ( d & (b ^ c) ) ) + ( b>>>2 ^ b>>>13 ^ b>>>22 ^ b<<30 ^ b<<19 ^ b<<10 ) )|0;
w4 = ( ( w5>>>7 ^ w5>>>18 ^ w5>>>3 ^ w5<<25 ^ w5<<14 ) + ( w2>>>17 ^ w2>>>19 ^ w2>>>10 ^ w2<<15 ^ w2<<13 ) + w4 + w13 )|0;
d = ( w4 + d + ( a>>>6 ^ a>>>11 ^ a>>>25 ^ a<<26 ^ a<<21 ^ a<<7 ) + ( c ^ a & (b^c) ) + 0x391c0cb3 )|0;
h = ( h + d )|0;
d = ( d + ( (e & f) ^ ( g & (e ^ f) ) ) + ( e>>>2 ^ e>>>13 ^ e>>>22 ^ e<<30 ^ e<<19 ^ e<<10 ) )|0;
// 53
w5 = t = ( ( w6>>>7 ^ w6>>>18 ^ w6>>>3 ^ w6<<25 ^ w6<<14 ) + ( w3>>>17 ^ w3>>>19 ^ w3>>>10 ^ w3<<15 ^ w3<<13 ) + w5 + w14 )|0;
t = ( t + h + ( e>>>6 ^ e>>>11 ^ e>>>25 ^ e<<26 ^ e<<21 ^ e<<7 ) + ( g ^ e & (f^g) ) + 0x4ed8aa4a )|0;
h = g; g = f; f = e; e = ( d + t )|0; d = c; c = b; b = a;
a = ( t + ( (b & c) ^ ( d & (b ^ c) ) ) + ( b>>>2 ^ b>>>13 ^ b>>>22 ^ b<<30 ^ b<<19 ^ b<<10 ) )|0;
w5 = ( ( w6>>>7 ^ w6>>>18 ^ w6>>>3 ^ w6<<25 ^ w6<<14 ) + ( w3>>>17 ^ w3>>>19 ^ w3>>>10 ^ w3<<15 ^ w3<<13 ) + w5 + w14 )|0;
c = ( w5 + c + ( h>>>6 ^ h>>>11 ^ h>>>25 ^ h<<26 ^ h<<21 ^ h<<7 ) + ( b ^ h & (a^b) ) + 0x4ed8aa4a )|0;
g = ( g + c )|0;
c = ( c + ( (d & e) ^ ( f & (d ^ e) ) ) + ( d>>>2 ^ d>>>13 ^ d>>>22 ^ d<<30 ^ d<<19 ^ d<<10 ) )|0;
// 54
w6 = t = ( ( w7>>>7 ^ w7>>>18 ^ w7>>>3 ^ w7<<25 ^ w7<<14 ) + ( w4>>>17 ^ w4>>>19 ^ w4>>>10 ^ w4<<15 ^ w4<<13 ) + w6 + w15 )|0;
t = ( t + h + ( e>>>6 ^ e>>>11 ^ e>>>25 ^ e<<26 ^ e<<21 ^ e<<7 ) + ( g ^ e & (f^g) ) + 0x5b9cca4f )|0;
h = g; g = f; f = e; e = ( d + t )|0; d = c; c = b; b = a;
a = ( t + ( (b & c) ^ ( d & (b ^ c) ) ) + ( b>>>2 ^ b>>>13 ^ b>>>22 ^ b<<30 ^ b<<19 ^ b<<10 ) )|0;
w6 = ( ( w7>>>7 ^ w7>>>18 ^ w7>>>3 ^ w7<<25 ^ w7<<14 ) + ( w4>>>17 ^ w4>>>19 ^ w4>>>10 ^ w4<<15 ^ w4<<13 ) + w6 + w15 )|0;
b = ( w6 + b + ( g>>>6 ^ g>>>11 ^ g>>>25 ^ g<<26 ^ g<<21 ^ g<<7 ) + ( a ^ g & (h^a) ) + 0x5b9cca4f )|0;
f = ( f + b )|0;
b = ( b + ( (c & d) ^ ( e & (c ^ d) ) ) + ( c>>>2 ^ c>>>13 ^ c>>>22 ^ c<<30 ^ c<<19 ^ c<<10 ) )|0;
// 55
w7 = t = ( ( w8>>>7 ^ w8>>>18 ^ w8>>>3 ^ w8<<25 ^ w8<<14 ) + ( w5>>>17 ^ w5>>>19 ^ w5>>>10 ^ w5<<15 ^ w5<<13 ) + w7 + w0 )|0;
t = ( t + h + ( e>>>6 ^ e>>>11 ^ e>>>25 ^ e<<26 ^ e<<21 ^ e<<7 ) + ( g ^ e & (f^g) ) + 0x682e6ff3 )|0;
h = g; g = f; f = e; e = ( d + t )|0; d = c; c = b; b = a;
a = ( t + ( (b & c) ^ ( d & (b ^ c) ) ) + ( b>>>2 ^ b>>>13 ^ b>>>22 ^ b<<30 ^ b<<19 ^ b<<10 ) )|0;
w7 = ( ( w8>>>7 ^ w8>>>18 ^ w8>>>3 ^ w8<<25 ^ w8<<14 ) + ( w5>>>17 ^ w5>>>19 ^ w5>>>10 ^ w5<<15 ^ w5<<13 ) + w7 + w0 )|0;
a = ( w7 + a + ( f>>>6 ^ f>>>11 ^ f>>>25 ^ f<<26 ^ f<<21 ^ f<<7 ) + ( h ^ f & (g^h) ) + 0x682e6ff3 )|0;
e = ( e + a )|0;
a = ( a + ( (b & c) ^ ( d & (b ^ c) ) ) + ( b>>>2 ^ b>>>13 ^ b>>>22 ^ b<<30 ^ b<<19 ^ b<<10 ) )|0;
// 56
w8 = t = ( ( w9>>>7 ^ w9>>>18 ^ w9>>>3 ^ w9<<25 ^ w9<<14 ) + ( w6>>>17 ^ w6>>>19 ^ w6>>>10 ^ w6<<15 ^ w6<<13 ) + w8 + w1 )|0;
t = ( t + h + ( e>>>6 ^ e>>>11 ^ e>>>25 ^ e<<26 ^ e<<21 ^ e<<7 ) + ( g ^ e & (f^g) ) + 0x748f82ee )|0;
h = g; g = f; f = e; e = ( d + t )|0; d = c; c = b; b = a;
a = ( t + ( (b & c) ^ ( d & (b ^ c) ) ) + ( b>>>2 ^ b>>>13 ^ b>>>22 ^ b<<30 ^ b<<19 ^ b<<10 ) )|0;
w8 = ( ( w9>>>7 ^ w9>>>18 ^ w9>>>3 ^ w9<<25 ^ w9<<14 ) + ( w6>>>17 ^ w6>>>19 ^ w6>>>10 ^ w6<<15 ^ w6<<13 ) + w8 + w1 )|0;
h = ( w8 + h + ( e>>>6 ^ e>>>11 ^ e>>>25 ^ e<<26 ^ e<<21 ^ e<<7 ) + ( g ^ e & (f^g) ) + 0x748f82ee )|0;
d = ( d + h )|0;
h = ( h + ( (a & b) ^ ( c & (a ^ b) ) ) + ( a>>>2 ^ a>>>13 ^ a>>>22 ^ a<<30 ^ a<<19 ^ a<<10 ) )|0;
// 57
w9 = t = ( ( w10>>>7 ^ w10>>>18 ^ w10>>>3 ^ w10<<25 ^ w10<<14 ) + ( w7>>>17 ^ w7>>>19 ^ w7>>>10 ^ w7<<15 ^ w7<<13 ) + w9 + w2 )|0;
t = ( t + h + ( e>>>6 ^ e>>>11 ^ e>>>25 ^ e<<26 ^ e<<21 ^ e<<7 ) + ( g ^ e & (f^g) ) + 0x78a5636f )|0;
h = g; g = f; f = e; e = ( d + t )|0; d = c; c = b; b = a;
a = ( t + ( (b & c) ^ ( d & (b ^ c) ) ) + ( b>>>2 ^ b>>>13 ^ b>>>22 ^ b<<30 ^ b<<19 ^ b<<10 ) )|0;
w9 = ( ( w10>>>7 ^ w10>>>18 ^ w10>>>3 ^ w10<<25 ^ w10<<14 ) + ( w7>>>17 ^ w7>>>19 ^ w7>>>10 ^ w7<<15 ^ w7<<13 ) + w9 + w2 )|0;
g = ( w9 + g + ( d>>>6 ^ d>>>11 ^ d>>>25 ^ d<<26 ^ d<<21 ^ d<<7 ) + ( f ^ d & (e^f) ) + 0x78a5636f )|0;
c = ( c + g )|0;
g = ( g + ( (h & a) ^ ( b & (h ^ a) ) ) + ( h>>>2 ^ h>>>13 ^ h>>>22 ^ h<<30 ^ h<<19 ^ h<<10 ) )|0;
// 58
w10 = t = ( ( w11>>>7 ^ w11>>>18 ^ w11>>>3 ^ w11<<25 ^ w11<<14 ) + ( w8>>>17 ^ w8>>>19 ^ w8>>>10 ^ w8<<15 ^ w8<<13 ) + w10 + w3 )|0;
t = ( t + h + ( e>>>6 ^ e>>>11 ^ e>>>25 ^ e<<26 ^ e<<21 ^ e<<7 ) + ( g ^ e & (f^g) ) + 0x84c87814 )|0;
h = g; g = f; f = e; e = ( d + t )|0; d = c; c = b; b = a;
a = ( t + ( (b & c) ^ ( d & (b ^ c) ) ) + ( b>>>2 ^ b>>>13 ^ b>>>22 ^ b<<30 ^ b<<19 ^ b<<10 ) )|0;
w10 = ( ( w11>>>7 ^ w11>>>18 ^ w11>>>3 ^ w11<<25 ^ w11<<14 ) + ( w8>>>17 ^ w8>>>19 ^ w8>>>10 ^ w8<<15 ^ w8<<13 ) + w10 + w3 )|0;
f = ( w10 + f + ( c>>>6 ^ c>>>11 ^ c>>>25 ^ c<<26 ^ c<<21 ^ c<<7 ) + ( e ^ c & (d^e) ) + 0x84c87814 )|0;
b = ( b + f )|0;
f = ( f + ( (g & h) ^ ( a & (g ^ h) ) ) + ( g>>>2 ^ g>>>13 ^ g>>>22 ^ g<<30 ^ g<<19 ^ g<<10 ) )|0;
// 59
w11 = t = ( ( w12>>>7 ^ w12>>>18 ^ w12>>>3 ^ w12<<25 ^ w12<<14 ) + ( w9>>>17 ^ w9>>>19 ^ w9>>>10 ^ w9<<15 ^ w9<<13 ) + w11 + w4 )|0;
t = ( t + h + ( e>>>6 ^ e>>>11 ^ e>>>25 ^ e<<26 ^ e<<21 ^ e<<7 ) + ( g ^ e & (f^g) ) + 0x8cc70208 )|0;
h = g; g = f; f = e; e = ( d + t )|0; d = c; c = b; b = a;
a = ( t + ( (b & c) ^ ( d & (b ^ c) ) ) + ( b>>>2 ^ b>>>13 ^ b>>>22 ^ b<<30 ^ b<<19 ^ b<<10 ) )|0;
w11 = ( ( w12>>>7 ^ w12>>>18 ^ w12>>>3 ^ w12<<25 ^ w12<<14 ) + ( w9>>>17 ^ w9>>>19 ^ w9>>>10 ^ w9<<15 ^ w9<<13 ) + w11 + w4 )|0;
e = ( w11 + e + ( b>>>6 ^ b>>>11 ^ b>>>25 ^ b<<26 ^ b<<21 ^ b<<7 ) + ( d ^ b & (c^d) ) + 0x8cc70208 )|0;
a = ( a + e )|0;
e = ( e + ( (f & g) ^ ( h & (f ^ g) ) ) + ( f>>>2 ^ f>>>13 ^ f>>>22 ^ f<<30 ^ f<<19 ^ f<<10 ) )|0;
// 60
w12 = t = ( ( w13>>>7 ^ w13>>>18 ^ w13>>>3 ^ w13<<25 ^ w13<<14 ) + ( w10>>>17 ^ w10>>>19 ^ w10>>>10 ^ w10<<15 ^ w10<<13 ) + w12 + w5 )|0;
t = ( t + h + ( e>>>6 ^ e>>>11 ^ e>>>25 ^ e<<26 ^ e<<21 ^ e<<7 ) + ( g ^ e & (f^g) ) + 0x90befffa )|0;
h = g; g = f; f = e; e = ( d + t )|0; d = c; c = b; b = a;
a = ( t + ( (b & c) ^ ( d & (b ^ c) ) ) + ( b>>>2 ^ b>>>13 ^ b>>>22 ^ b<<30 ^ b<<19 ^ b<<10 ) )|0;
w12 = ( ( w13>>>7 ^ w13>>>18 ^ w13>>>3 ^ w13<<25 ^ w13<<14 ) + ( w10>>>17 ^ w10>>>19 ^ w10>>>10 ^ w10<<15 ^ w10<<13 ) + w12 + w5 )|0;
d = ( w12 + d + ( a>>>6 ^ a>>>11 ^ a>>>25 ^ a<<26 ^ a<<21 ^ a<<7 ) + ( c ^ a & (b^c) ) + 0x90befffa )|0;
h = ( h + d )|0;
d = ( d + ( (e & f) ^ ( g & (e ^ f) ) ) + ( e>>>2 ^ e>>>13 ^ e>>>22 ^ e<<30 ^ e<<19 ^ e<<10 ) )|0;
// 61
w13 = t = ( ( w14>>>7 ^ w14>>>18 ^ w14>>>3 ^ w14<<25 ^ w14<<14 ) + ( w11>>>17 ^ w11>>>19 ^ w11>>>10 ^ w11<<15 ^ w11<<13 ) + w13 + w6 )|0;
t = ( t + h + ( e>>>6 ^ e>>>11 ^ e>>>25 ^ e<<26 ^ e<<21 ^ e<<7 ) + ( g ^ e & (f^g) ) + 0xa4506ceb )|0;
h = g; g = f; f = e; e = ( d + t )|0; d = c; c = b; b = a;
a = ( t + ( (b & c) ^ ( d & (b ^ c) ) ) + ( b>>>2 ^ b>>>13 ^ b>>>22 ^ b<<30 ^ b<<19 ^ b<<10 ) )|0;
w13 = ( ( w14>>>7 ^ w14>>>18 ^ w14>>>3 ^ w14<<25 ^ w14<<14 ) + ( w11>>>17 ^ w11>>>19 ^ w11>>>10 ^ w11<<15 ^ w11<<13 ) + w13 + w6 )|0;
c = ( w13 + c + ( h>>>6 ^ h>>>11 ^ h>>>25 ^ h<<26 ^ h<<21 ^ h<<7 ) + ( b ^ h & (a^b) ) + 0xa4506ceb )|0;
g = ( g + c )|0;
c = ( c + ( (d & e) ^ ( f & (d ^ e) ) ) + ( d>>>2 ^ d>>>13 ^ d>>>22 ^ d<<30 ^ d<<19 ^ d<<10 ) )|0;
// 62
w14 = t = ( ( w15>>>7 ^ w15>>>18 ^ w15>>>3 ^ w15<<25 ^ w15<<14 ) + ( w12>>>17 ^ w12>>>19 ^ w12>>>10 ^ w12<<15 ^ w12<<13 ) + w14 + w7 )|0;
t = ( t + h + ( e>>>6 ^ e>>>11 ^ e>>>25 ^ e<<26 ^ e<<21 ^ e<<7 ) + ( g ^ e & (f^g) ) + 0xbef9a3f7 )|0;
h = g; g = f; f = e; e = ( d + t )|0; d = c; c = b; b = a;
a = ( t + ( (b & c) ^ ( d & (b ^ c) ) ) + ( b>>>2 ^ b>>>13 ^ b>>>22 ^ b<<30 ^ b<<19 ^ b<<10 ) )|0;
w14 = ( ( w15>>>7 ^ w15>>>18 ^ w15>>>3 ^ w15<<25 ^ w15<<14 ) + ( w12>>>17 ^ w12>>>19 ^ w12>>>10 ^ w12<<15 ^ w12<<13 ) + w14 + w7 )|0;
b = ( w14 + b + ( g>>>6 ^ g>>>11 ^ g>>>25 ^ g<<26 ^ g<<21 ^ g<<7 ) + ( a ^ g & (h^a) ) + 0xbef9a3f7 )|0;
f = ( f + b )|0;
b = ( b + ( (c & d) ^ ( e & (c ^ d) ) ) + ( c>>>2 ^ c>>>13 ^ c>>>22 ^ c<<30 ^ c<<19 ^ c<<10 ) )|0;
// 63
w15 = t = ( ( w0>>>7 ^ w0>>>18 ^ w0>>>3 ^ w0<<25 ^ w0<<14 ) + ( w13>>>17 ^ w13>>>19 ^ w13>>>10 ^ w13<<15 ^ w13<<13 ) + w15 + w8 )|0;
t = ( t + h + ( e>>>6 ^ e>>>11 ^ e>>>25 ^ e<<26 ^ e<<21 ^ e<<7 ) + ( g ^ e & (f^g) ) + 0xc67178f2 )|0;
h = g; g = f; f = e; e = ( d + t )|0; d = c; c = b; b = a;
a = ( t + ( (b & c) ^ ( d & (b ^ c) ) ) + ( b>>>2 ^ b>>>13 ^ b>>>22 ^ b<<30 ^ b<<19 ^ b<<10 ) )|0;
w15 = ( ( w0>>>7 ^ w0>>>18 ^ w0>>>3 ^ w0<<25 ^ w0<<14 ) + ( w13>>>17 ^ w13>>>19 ^ w13>>>10 ^ w13<<15 ^ w13<<13 ) + w15 + w8 )|0;
a = ( w15 + a + ( f>>>6 ^ f>>>11 ^ f>>>25 ^ f<<26 ^ f<<21 ^ f<<7 ) + ( h ^ f & (g^h) ) + 0xc67178f2 )|0;
e = ( e + a )|0;
a = ( a + ( (b & c) ^ ( d & (b ^ c) ) ) + ( b>>>2 ^ b>>>13 ^ b>>>22 ^ b<<30 ^ b<<19 ^ b<<10 ) )|0;

@@ -415,0 +414,0 @@ H0 = ( H0 + a )|0;

@@ -1,5 +0,9 @@

var _sha256_block_size = 64,
_sha256_hash_size = 32;
import {sha256_asm} from './sha256.asm';
import {hash_finish, hash_process, hash_reset} from '../hash';
import {_heap_init} from '../../utils';
function sha256_constructor ( options ) {
export var _sha256_block_size = 64;
export var _sha256_hash_size = 32;
export function sha256_constructor ( options ) {
options = options || {};

@@ -18,2 +22,4 @@

sha256_constructor.HASH_SIZE = _sha256_hash_size;
sha256_constructor.NAME = "sha256";
var sha256_prototype = sha256_constructor.prototype;

@@ -26,5 +32,5 @@ sha256_prototype.reset = hash_reset;

function get_sha256_instance () {
export function get_sha256_instance () {
if ( sha256_instance === null ) sha256_instance = new sha256_constructor( { heapSize: 0x100000 } );
return sha256_instance;
}

@@ -5,3 +5,6 @@ /**

function sha512_bytes ( data ) {
import {get_sha512_instance, sha512_constructor} from './sha512';
import {bytes_to_base64, bytes_to_hex} from '../../utils';
function sha512_bytes (data ) {
if ( data === undefined ) throw new SyntaxError("data required");

@@ -21,6 +24,6 @@ return get_sha512_instance().reset().process(data).finish().result;

sha512_constructor.bytes = sha512_bytes;
sha512_constructor.hex = sha512_hex;
sha512_constructor.base64 = sha512_base64;
export var SHA512 = sha512_constructor;
exports.SHA512 = sha512_constructor;
SHA512.bytes = sha512_bytes;
SHA512.hex = sha512_hex;
SHA512.base64 = sha512_base64;

@@ -1,5 +0,9 @@

var _sha512_block_size = 128,
_sha512_hash_size = 64;
import {hash_finish, hash_process, hash_reset} from '../hash';
import {sha512_asm} from './sha512.asm';
import {_heap_init} from '../../utils';
function sha512_constructor ( options ) {
export var _sha512_block_size = 128;
export var _sha512_hash_size = 64;
export function sha512_constructor ( options ) {
options = options || {};

@@ -18,2 +22,4 @@

sha512_constructor.HASH_SIZE = _sha512_hash_size;
sha512_constructor.NAME = "sha512";
var sha512_prototype = sha512_constructor.prototype;

@@ -26,5 +32,5 @@ sha512_prototype.reset = hash_reset;

function get_sha512_instance () {
export function get_sha512_instance () {
if ( sha512_instance === null ) sha512_instance = new sha512_constructor( { heapSize: 0x100000 } );
return sha512_instance;
}

@@ -5,3 +5,6 @@ /**

function hmac_sha1_bytes ( data, password ) {
import {get_hmac_sha1_instance, hmac_sha1_constructor} from './hmac-sha1';
import {bytes_to_base64, bytes_to_hex} from '../utils';
function hmac_sha1_bytes (data, password ) {
if ( data === undefined ) throw new SyntaxError("data required");

@@ -22,8 +25,6 @@ if ( password === undefined ) throw new SyntaxError("password required");

exports.HMAC = hmac_constructor;
export var HMAC_SHA1 = hmac_sha1_constructor;
hmac_sha1_constructor.bytes = hmac_sha1_bytes;
hmac_sha1_constructor.hex = hmac_sha1_hex;
hmac_sha1_constructor.base64 = hmac_sha1_base64;
exports.HMAC_SHA1 = hmac_sha1_constructor;
HMAC_SHA1.bytes = hmac_sha1_bytes;
HMAC_SHA1.hex = hmac_sha1_hex;
HMAC_SHA1.base64 = hmac_sha1_base64;

@@ -5,3 +5,6 @@ /**

function hmac_sha256_bytes ( data, password ) {
import {get_hmac_sha256_instance, hmac_sha256_constructor} from './hmac-sha256';
import {bytes_to_base64, bytes_to_hex} from '../utils';
function hmac_sha256_bytes (data, password ) {
if ( data === undefined ) throw new SyntaxError("data required");

@@ -22,6 +25,6 @@ if ( password === undefined ) throw new SyntaxError("password required");

hmac_sha256_constructor.bytes = hmac_sha256_bytes;
hmac_sha256_constructor.hex = hmac_sha256_hex;
hmac_sha256_constructor.base64 = hmac_sha256_base64;
export var HMAC_SHA256 = hmac_sha256_constructor;
exports.HMAC_SHA256 = hmac_sha256_constructor;
HMAC_SHA256.bytes = hmac_sha256_bytes;
HMAC_SHA256.hex = hmac_sha256_hex;
HMAC_SHA256.base64 = hmac_sha256_base64;

@@ -5,3 +5,6 @@ /**

function hmac_sha512_bytes ( data, password ) {
import {get_hmac_sha512_instance, hmac_sha512_constructor} from './hmac-sha512';
import {bytes_to_base64, bytes_to_hex} from '../utils';
function hmac_sha512_bytes (data, password ) {
if ( data === undefined ) throw new SyntaxError("data required");

@@ -22,6 +25,6 @@ if ( password === undefined ) throw new SyntaxError("password required");

hmac_sha512_constructor.bytes = hmac_sha512_bytes;
hmac_sha512_constructor.hex = hmac_sha512_hex;
hmac_sha512_constructor.base64 = hmac_sha512_base64;
export var HMAC_SHA512 = hmac_sha512_constructor;
exports.HMAC_SHA512 = hmac_sha512_constructor;
HMAC_SHA512.bytes = hmac_sha512_bytes;
HMAC_SHA512.hex = hmac_sha512_hex;
HMAC_SHA512.base64 = hmac_sha512_base64;

@@ -1,2 +0,7 @@

function hmac_sha1_constructor ( options ) {
import {hmac_process, hmac_constructor, _hmac_key, _hmac_init_verify} from './hmac';
import {_sha1_hash_size, get_sha1_instance, sha1_constructor} from '../hash/sha1/sha1';
import {is_string, string_to_bytes} from '../utils';
import {IllegalStateError} from '../errors';
export function hmac_sha1_constructor (options ) {
options = options || {};

@@ -103,5 +108,5 @@

function get_hmac_sha1_instance () {
export function get_hmac_sha1_instance () {
if ( hmac_sha1_instance === null ) hmac_sha1_instance = new hmac_sha1_constructor();
return hmac_sha1_instance;
}

@@ -1,2 +0,7 @@

function hmac_sha256_constructor ( options ) {
import {hmac_constructor, hmac_process, _hmac_init_verify, _hmac_key} from './hmac';
import {_sha256_hash_size, get_sha256_instance, sha256_constructor} from '../hash/sha256/sha256';
import {is_string, string_to_bytes} from '../utils';
import {IllegalStateError} from '../errors';
export function hmac_sha256_constructor (options ) {
options = options || {};

@@ -103,5 +108,5 @@

function get_hmac_sha256_instance () {
export function get_hmac_sha256_instance () {
if ( hmac_sha256_instance === null ) hmac_sha256_instance = new hmac_sha256_constructor();
return hmac_sha256_instance;
}

@@ -1,2 +0,7 @@

function hmac_sha512_constructor ( options ) {
import {_sha512_hash_size, get_sha512_instance, sha512_constructor} from '../hash/sha512/sha512';
import {hmac_constructor, _hmac_init_verify, _hmac_key, hmac_process} from './hmac';
import {is_string, string_to_bytes} from '../utils';
import {IllegalStateError} from '../errors';
export function hmac_sha512_constructor (options ) {
options = options || {};

@@ -119,5 +124,5 @@

function get_hmac_sha512_instance () {
export function get_hmac_sha512_instance () {
if ( hmac_sha512_instance === null ) hmac_sha512_instance = new hmac_sha512_constructor();
return hmac_sha512_instance;
}

@@ -1,2 +0,5 @@

function hmac_constructor ( options ) {
import {is_buffer, is_bytes, is_string, string_to_bytes} from '../utils';
import {IllegalArgumentError, IllegalStateError} from '../errors';
export function hmac_constructor (options ) {
options = options || {};

@@ -24,3 +27,3 @@

function _hmac_key ( hash, password ) {
export function _hmac_key ( hash, password ) {
if ( is_buffer(password) )

@@ -47,3 +50,3 @@ password = new Uint8Array(password);

function _hmac_init_verify ( verify ) {
export function _hmac_init_verify ( verify ) {
if ( is_buffer(verify) || is_bytes(verify) ) {

@@ -95,3 +98,3 @@ verify = new Uint8Array(verify);

function hmac_process ( data ) {
export function hmac_process ( data ) {
if ( this.key === null )

@@ -98,0 +101,0 @@ throw new IllegalStateError("no key is associated with the instance");

@@ -1,4 +0,4 @@

var _global_console = global.console;
var _global_console = typeof console !== 'undefined' ? console : undefined;
var _secure_origin = (global.location === undefined) || !global.location.protocol.search( /https:|file:|chrome:|chrome-extension:|moz-extension:/ );
var _secure_origin = (typeof location === "undefined") || !location.protocol.search( /https:|file:|chrome:|chrome-extension:|moz-extension:/ );

@@ -5,0 +5,0 @@ if ( !_secure_origin && _global_console !== undefined ) {

@@ -5,3 +5,6 @@ /**

function pbkdf2_hmac_sha1_bytes ( password, salt, iterations, dklen ) {
import {bytes_to_base64, bytes_to_hex} from '../utils';
import {get_pbkdf2_hmac_sha1_instance} from './pbkdf2-hmac-sha1';
function pbkdf2_hmac_sha1_bytes (password, salt, iterations, dklen ) {
if ( password === undefined ) throw new SyntaxError("password required");

@@ -22,4 +25,3 @@ if ( salt === undefined ) throw new SyntaxError("salt required");

exports.PBKDF2 =
exports.PBKDF2_HMAC_SHA1 = {
export var PBKDF2 = {
bytes: pbkdf2_hmac_sha1_bytes,

@@ -29,1 +31,7 @@ hex: pbkdf2_hmac_sha1_hex,

};
export var PBKDF2_HMAC_SHA1 = {
bytes: pbkdf2_hmac_sha1_bytes,
hex: pbkdf2_hmac_sha1_hex,
base64: pbkdf2_hmac_sha1_base64
};

@@ -5,3 +5,6 @@ /**

function pbkdf2_hmac_sha256_bytes ( password, salt, iterations, dklen ) {
import {get_pbkdf2_hmac_sha256_instance} from './pbkdf2-hmac-sha256';
import {bytes_to_base64, bytes_to_hex} from '../utils';
function pbkdf2_hmac_sha256_bytes (password, salt, iterations, dklen ) {
if ( password === undefined ) throw new SyntaxError("password required");

@@ -22,3 +25,3 @@ if ( salt === undefined ) throw new SyntaxError("salt required");

exports.PBKDF2_HMAC_SHA256 = {
export var PBKDF2_HMAC_SHA256 = {
bytes: pbkdf2_hmac_sha256_bytes,

@@ -25,0 +28,0 @@ hex: pbkdf2_hmac_sha256_hex,

@@ -5,3 +5,6 @@ /**

function pbkdf2_hmac_sha512_bytes ( password, salt, iterations, dklen ) {
import {get_pbkdf2_hmac_sha512_instance} from './pbkdf2-hmac-sha512';
import {bytes_to_base64, bytes_to_hex} from '../utils';
function pbkdf2_hmac_sha512_bytes (password, salt, iterations, dklen ) {
if ( password === undefined ) throw new SyntaxError("password required");

@@ -22,3 +25,3 @@ if ( salt === undefined ) throw new SyntaxError("salt required");

exports.PBKDF2_HMAC_SHA512 = {
export var PBKDF2_HMAC_SHA512 = {
bytes: pbkdf2_hmac_sha512_bytes,

@@ -25,0 +28,0 @@ hex: pbkdf2_hmac_sha512_hex,

@@ -1,2 +0,7 @@

function pbkdf2_hmac_sha1_constructor ( options ) {
import {get_hmac_sha1_instance, hmac_sha1_constructor} from '../hmac/hmac-sha1';
import {pbkdf2_constructor, pbkdf2_reset} from './pbkdf2';
import {is_string} from '../utils';
import {IllegalArgumentError, IllegalStateError} from '../errors';
export function pbkdf2_hmac_sha1_constructor (options ) {
options = options || {};

@@ -45,5 +50,5 @@

function get_pbkdf2_hmac_sha1_instance () {
export function get_pbkdf2_hmac_sha1_instance () {
if ( pbkdf2_hmac_sha1_instance === null ) pbkdf2_hmac_sha1_instance = new pbkdf2_hmac_sha1_constructor();
return pbkdf2_hmac_sha1_instance;
}

@@ -1,2 +0,7 @@

function pbkdf2_hmac_sha256_constructor ( options ) {
import {pbkdf2_constructor, pbkdf2_reset} from './pbkdf2';
import {get_hmac_sha256_instance, hmac_sha256_constructor} from '../hmac/hmac-sha256';
import {is_string} from '../utils';
import {IllegalArgumentError, IllegalStateError} from '../errors';
export function pbkdf2_hmac_sha256_constructor ( options ) {
options = options || {};

@@ -45,5 +50,5 @@

function get_pbkdf2_hmac_sha256_instance () {
export function get_pbkdf2_hmac_sha256_instance () {
if ( pbkdf2_hmac_sha256_instance === null ) pbkdf2_hmac_sha256_instance = new pbkdf2_hmac_sha256_constructor();
return pbkdf2_hmac_sha256_instance;
}

@@ -1,2 +0,7 @@

function pbkdf2_hmac_sha512_constructor ( options ) {
import {pbkdf2_constructor, pbkdf2_reset} from './pbkdf2';
import {get_hmac_sha512_instance, hmac_sha512_constructor} from '../hmac/hmac-sha512';
import {is_string} from '../utils';
import {IllegalArgumentError, IllegalStateError} from '../errors';
export function pbkdf2_hmac_sha512_constructor ( options ) {
options = options || {};

@@ -45,5 +50,5 @@

function get_pbkdf2_hmac_sha512_instance () {
export function get_pbkdf2_hmac_sha512_instance () {
if ( pbkdf2_hmac_sha512_instance === null ) pbkdf2_hmac_sha512_instance = new pbkdf2_hmac_sha512_constructor();
return pbkdf2_hmac_sha512_instance;
}

@@ -1,2 +0,5 @@

function pbkdf2_constructor ( options ) {
import {is_string} from '../utils';
import {IllegalArgumentError, IllegalStateError} from '../errors';
export function pbkdf2_constructor (options ) {
options = options || {};

@@ -23,3 +26,3 @@

function pbkdf2_reset ( options ) {
export function pbkdf2_reset ( options ) {
this.result = null;

@@ -26,0 +29,0 @@

@@ -1,27 +0,4 @@

exports.random = Random_getNumber;
exports.random.seed = Random_seed;
Object.defineProperty( Random_getNumber, 'allowWeak', {
get: function () { return _random_allow_weak; },
set: function ( a ) { _random_allow_weak = a; }
});
Object.defineProperty( Random_getNumber, 'skipSystemRNGWarning', {
get: function () { return _random_skip_system_rng_warning; },
set: function ( w ) { _random_skip_system_rng_warning = w; }
});
exports.getRandomValues = Random_getValues;
exports.getRandomValues.seed = Random_seed;
Object.defineProperty( Random_getValues, 'allowWeak', {
get: function () { return _random_allow_weak; },
set: function ( a ) { _random_allow_weak = a; }
});
Object.defineProperty( Random_getValues, 'skipSystemRNGWarning', {
get: function () { return _random_skip_system_rng_warning; },
set: function ( w ) { _random_skip_system_rng_warning = w; }
});
export {
Random_getNumber as random,
Random_getValues as getRandomValues
} from './random';

@@ -1,4 +0,6 @@

global.Math.random = Random_getNumber;
import {Random_getNumber, Random_getValues} from './random';
if ( global.crypto === undefined ) global.crypto = {};
global.crypto.getRandomValues = Random_getValues;
Math.random = Random_getNumber;
if ( typeof 'crypto' === 'undefined' ) var crypto = {};
crypto.getRandomValues = Random_getValues;

@@ -39,3 +39,5 @@ /* ----------------------------------------------------------------------

var ISAAC = ( function () {
import {FloatArray, is_buffer, is_number, is_string, is_typed_array, string_to_bytes} from '../utils';
export var ISAAC = ( function () {
var m = new Uint32Array(256), // internal memory

@@ -42,0 +44,0 @@ r = new Uint32Array(256), // result array

@@ -1,6 +0,11 @@

var _global_console = global.console,
_global_date_now = global.Date.now,
_global_math_random = global.Math.random,
_global_performance = global.performance,
_global_crypto = global.crypto || global.msCrypto,
import { ISAAC } from './isaac';
import {FloatArray, is_buffer, is_typed_array} from '../utils';
import {get_pbkdf2_hmac_sha256_instance} from '../pbkdf2/pbkdf2-hmac-sha256';
import {SecurityError} from '../errors';
var _global_console = typeof console !== "undefined" ? console : undefined,
_global_date_now = Date.now,
_global_math_random = Math.random,
_global_performance = typeof performance !== "undefined" ? performance : undefined,
_global_crypto = typeof crypto !== "undefined" ? crypto : (typeof msCrypto !== "undefined" ? msCrypto : undefined),
_global_crypto_getRandomValues;

@@ -19,6 +24,7 @@

_random_required_entropy = 256,
_random_allow_weak = false,
_random_skip_system_rng_warning = false,
_random_warn_callstacks = {};
export var _random_skip_system_rng_warning = false;
export var _random_allow_weak = false;
var _hires_now;

@@ -65,7 +71,7 @@ if ( _global_performance !== undefined ) {

var salt = '';
if ( global.location !== undefined ) {
salt += global.location.href;
if ( typeof location !== "undefined" ) {
salt += location.href;
}
else if ( global.process !== undefined ) {
salt += global.process.pid + global.process.title;
else if ( typeof process !== "undefined" ) {
salt += process.pid + process.title;
}

@@ -104,3 +110,3 @@

*/
function Random_seed ( seed ) {
export function Random_seed ( seed ) {
if ( !is_buffer(seed) && !is_typed_array(seed) )

@@ -156,3 +162,3 @@ throw new TypeError("bad seed type");

*/
function Random_getValues ( buffer ) {
export function Random_getValues ( buffer ) {
// opportunistically seed ISAAC with a weak seed; this hopefully makes an

@@ -215,3 +221,3 @@ // attack harder in the case where the system RNG is weak *and* we haven't

*/
function Random_getNumber () {
export function Random_getNumber () {
if ( !_isaac_weak_seeded || _isaac_counter >= 0x10000000000 )

@@ -225,1 +231,25 @@ Random_weak_seed();

}
Object.defineProperty( Random_getNumber, 'allowWeak', {
get: function () { return _random_allow_weak; },
set: function ( a ) { _random_allow_weak = a; }
});
Object.defineProperty( Random_getNumber, 'skipSystemRNGWarning', {
get: function () { return _random_skip_system_rng_warning; },
set: function ( w ) { _random_skip_system_rng_warning = w; }
});
Object.defineProperty( Random_getValues, 'allowWeak', {
get: function () { return _random_allow_weak; },
set: function ( a ) { _random_allow_weak = a; }
});
Object.defineProperty( Random_getValues, 'skipSystemRNGWarning', {
get: function () { return _random_skip_system_rng_warning; },
set: function ( w ) { _random_skip_system_rng_warning = w; }
});
Random_getNumber.seed = Random_seed;
Random_getValues.seed = Random_seed;
/**
* RSA keygen exports
*/
function rsa_generate_key ( bitlen, e ) {
import {is_big_number} from '../bignum/bignum';
import {RSA_generateKey} from './genkey';
function rsa_generate_key (bitlen, e ) {
if ( bitlen === undefined ) throw new SyntaxError("bitlen required");

@@ -15,4 +18,4 @@ if ( e === undefined ) throw new SyntaxError("e required");

exports.RSA = {
export var RSA = {
generateKey: rsa_generate_key
};

@@ -5,3 +5,6 @@ /**

function rsa_oaep_sha1_encrypt_bytes ( data, key, label ) {
import {RSA_OAEP} from './pkcs1';
import {get_sha1_instance} from '../hash/sha1/sha1';
function rsa_oaep_sha1_encrypt_bytes (data, key, label ) {
if ( data === undefined ) throw new SyntaxError("data required");

@@ -18,7 +21,5 @@ if ( key === undefined ) throw new SyntaxError("key required");

exports.RSA_OAEP = RSA_OAEP;
exports.RSA_OAEP_SHA1 = {
export var RSA_OAEP_SHA1 = {
encrypt: rsa_oaep_sha1_encrypt_bytes,
decrypt: rsa_oaep_sha1_decrypt_bytes
};

@@ -5,3 +5,6 @@ /**

function rsa_oaep_sha256_encrypt_bytes ( data, key, label ) {
import {RSA_OAEP} from './pkcs1';
import {get_sha256_instance} from '../hash/sha256/sha256';
function rsa_oaep_sha256_encrypt_bytes (data, key, label ) {
if ( data === undefined ) throw new SyntaxError("data required");

@@ -18,7 +21,5 @@ if ( key === undefined ) throw new SyntaxError("key required");

exports.RSA_OAEP = RSA_OAEP;
exports.RSA_OAEP_SHA256 = {
export var RSA_OAEP_SHA256 = {
encrypt: rsa_oaep_sha256_encrypt_bytes,
decrypt: rsa_oaep_sha256_decrypt_bytes
};

@@ -5,3 +5,6 @@ /**

function rsa_oaep_sha512_encrypt_bytes ( data, key, label ) {
import {RSA_OAEP} from './pkcs1';
import {get_sha512_instance} from '../hash/sha512/sha512';
function rsa_oaep_sha512_encrypt_bytes (data, key, label ) {
if ( data === undefined ) throw new SyntaxError("data required");

@@ -18,7 +21,5 @@ if ( key === undefined ) throw new SyntaxError("key required");

exports.RSA_OAEP = RSA_OAEP;
exports.RSA_OAEP_SHA512 = {
export var RSA_OAEP_SHA512 = {
encrypt: rsa_oaep_sha512_encrypt_bytes,
decrypt: rsa_oaep_sha512_decrypt_bytes
};

@@ -5,3 +5,7 @@ /**

function rsa_pss_sha1_sign_bytes ( data, key, slen ) {
import {RSA_PSS } from './pkcs1';
import {get_sha1_instance} from '../hash/sha1/sha1';
import {SecurityError} from '../errors';
function rsa_pss_sha1_sign_bytes (data, key, slen ) {
if ( data === undefined ) throw new SyntaxError("data required");

@@ -27,7 +31,5 @@ if ( key === undefined ) throw new SyntaxError("key required");

exports.RSA_PSS = RSA_PSS;
exports.RSA_PSS_SHA1 = {
export var RSA_PSS_SHA1 = {
sign: rsa_pss_sha1_sign_bytes,
verify: rsa_pss_sha1_verify_bytes
};

@@ -5,3 +5,7 @@ /**

function rsa_pss_sha256_sign_bytes ( data, key, slen ) {
import {get_sha256_instance} from '../hash/sha256/sha256';
import {RSA_PSS} from './pkcs1';
import {SecurityError} from '../errors';
function rsa_pss_sha256_sign_bytes (data, key, slen ) {
if ( data === undefined ) throw new SyntaxError("data required");

@@ -27,7 +31,5 @@ if ( key === undefined ) throw new SyntaxError("key required");

exports.RSA_PSS = RSA_PSS;
exports.RSA_PSS_SHA256 = {
export var RSA_PSS_SHA256 = {
sign: rsa_pss_sha256_sign_bytes,
verify: rsa_pss_sha256_verify_bytes
};

@@ -5,3 +5,7 @@ /**

function rsa_pss_sha512_sign_bytes ( data, key, slen ) {
import {RSA_PSS} from './pkcs1';
import {get_sha512_instance} from '../hash/sha512/sha512';
import {SecurityError} from '../errors';
function rsa_pss_sha512_sign_bytes (data, key, slen ) {
if ( data === undefined ) throw new SyntaxError("data required");

@@ -27,7 +31,5 @@ if ( key === undefined ) throw new SyntaxError("key required");

exports.RSA_PSS = RSA_PSS;
exports.RSA_PSS_SHA512 = {
export var RSA_PSS_SHA512 = {
sign: rsa_pss_sha512_sign_bytes,
verify: rsa_pss_sha512_verify_bytes
};

@@ -5,6 +5,8 @@ /**

import RSA from './raw';
function rsa_raw_encrypt_bytes ( data, key ) {
if ( data === undefined ) throw new SyntaxError("data required");
if ( key === undefined ) throw new SyntaxError("key required");
return (new RSA_RAW({ key: key })).encrypt(data).result;
return (new RSA({ key: key })).encrypt(data).result;
}

@@ -15,5 +17,7 @@

if ( key === undefined ) throw new SyntaxError("key required");
return (new RSA_RAW({ key: key })).decrypt(data).result;
return (new RSA({ key: key })).decrypt(data).result;
}
export var RSA_RAW = RSA;
RSA_RAW.encrypt = rsa_raw_encrypt_bytes;

@@ -24,2 +28,1 @@ RSA_RAW.decrypt = rsa_raw_decrypt_bytes;

exports.RSA_RAW = RSA_RAW;

@@ -7,3 +7,11 @@ /**

*/
function RSA_generateKey ( bitlen, e ) {
import {RSA} from './rsa';
import {BigNumber_randomProbablePrime} from '../bignum/prime';
import {BigNumber_extGCD} from '../bignum/extgcd';
import {BigNumber_constructor, is_big_number} from '../bignum/bignum';
import {Modulus} from '../bignum/modulus';
import {is_buffer, is_bytes, is_number, is_string, string_to_bytes} from '../utils';
import {IllegalArgumentError} from '../errors';
export function RSA_generateKey (bitlen, e ) {
bitlen = bitlen || 2048;

@@ -22,3 +30,3 @@ e = e || 65537;

if ( is_bytes(e) || is_number(e) || is_big_number(e) ) {
e = new BigNumber(e);
e = new BigNumber_constructor(e);
}

@@ -37,3 +45,3 @@ else {

function ( p ) {
p1 = new BigNumber(p); p1.limbs[0] -= 1;
p1 = new BigNumber_constructor(p); p1.limbs[0] -= 1;
return BigNumber_extGCD( p1, e ).gcd.valueOf() == 1;

@@ -48,3 +56,3 @@ }

if ( !( m.limbs[ ( (bitlen + 31) >> 5 ) - 1 ] >>> ( (bitlen - 1) & 31) ) ) return false;
q1 = new BigNumber(q); q1.limbs[0] -= 1;
q1 = new BigNumber_constructor(q); q1.limbs[0] -= 1;
return BigNumber_extGCD( q1, e ).gcd.valueOf() == 1;

@@ -68,1 +76,3 @@ }

RSA.generateKey = RSA_generateKey;
export default RSA;

@@ -1,2 +0,7 @@

function RSA_OAEP ( options ) {
import {RSA_reset, RSA_encrypt, RSA_decrypt} from './rsa'
import {Random_getValues} from '../random/random';
import {is_buffer, is_bytes, is_number, is_string, string_to_bytes} from '../utils';
import {IllegalArgumentError, IllegalStateError, SecurityError} from '../errors';
export function RSA_OAEP ( options ) {
options = options || {};

@@ -166,3 +171,3 @@

function RSA_PSS ( options ) {
export function RSA_PSS ( options ) {
options = options || {};

@@ -299,2 +304,123 @@

function RSA_PKCS1_v1_5(options) {
options = options || {};
if (!options.hash)
throw new SyntaxError("option 'hash' is required");
if (!options.hash.HASH_SIZE)
throw new SyntaxError("option 'hash' supplied doesn't seem to be a valid hash function");
this.hash = options.hash;
this.reset(options);
}
function RSA_PKCS1_v1_5_reset(options) {
options = options || {};
RSA_reset.call(this, options);
}
var HASH_PREFIXES = {
"sha1": new Uint8Array([0x30, 0x21, 0x30, 0x09, 0x06, 0x05, 0x2b, 0x0e, 0x03, 0x02, 0x1a, 0x05, 0x00, 0x04, 0x14]),
"sha256": new Uint8Array([0x30, 0x31, 0x30, 0x0d, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x01, 0x05, 0x00, 0x04, 0x20]),
"sha384": new Uint8Array([0x30, 0x41, 0x30, 0x0d, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x02, 0x05, 0x00, 0x04, 0x30]),
"sha512": new Uint8Array([0x30, 0x51, 0x30, 0x0d, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x03, 0x05, 0x00, 0x04, 0x40]),
}
function getHashPrefix(hash) {
var hashName = hash.constructor.NAME;
var prefix = HASH_PREFIXES[hashName];
if (!prefix) {
throw new Error("Cannot get hash prefix for hash algorithm '" + hashName + "'");
}
return prefix;
}
function RSA_PKCS1_v1_5_sign(data) {
if (!this.key) {
throw new IllegalStateError("no key is associated with the instance");
}
var prefix = getHashPrefix(this.hash);
var hash_size = this.hash.HASH_SIZE;
var t_len = prefix.length + hash_size;
var k = (this.key[0].bitLength + 7) >> 3;
if (k < t_len + 11) {
throw new Error("Message too long");
}
var m_hash = new Uint8Array(hash_size);
m_hash.set(this.hash.reset().process(data).finish().result);
// EM = 0x00 || 0x01 || PS || 0x00 || T
var em = new Uint8Array(k);
var i = 0;
em[i++] = 0; // 0x00
em[i++] = 1; // 0x01
// PS
for (i; i < k - t_len - 1; i++) {
em[i] = 0xff;
}
em[i++] = 0;
em.set(prefix, i); // 0x00
// T
em.set(m_hash, em.length - hash_size);
RSA_decrypt.call(this, em);
return this;
}
function RSA_PKCS1_v1_5_verify(signature, data) {
if (!this.key) {
throw new IllegalStateError("no key is associated with the instance");
}
var prefix = getHashPrefix(this.hash);
var hash_size = this.hash.HASH_SIZE;
var t_len = prefix.length + hash_size;
var k = (this.key[0].bitLength + 7) >> 3;
if (k < t_len + 11) {
throw new SecurityError("Bad signature");
}
RSA_encrypt.call(this, signature);
var m_hash = new Uint8Array(hash_size);
m_hash.set(this.hash.reset().process(data).finish().result);
var res = 1;
// EM = 0x00 || 0x01 || PS || 0x00 || T
var decryptedSignature = this.result;
var i = 0;
res &= decryptedSignature[i++] === 0; // 0x00
res &= decryptedSignature[i++] === 1; // 0x01
// PS
for (i; i < k - t_len - 1; i++) {
res &= decryptedSignature[i] === 0xff;
}
res &= decryptedSignature[i++] === 0; // 0x00
// T
var j = 0;
var n = i + prefix.length;
// prefix
for (i; i < n; i++) {
res &= decryptedSignature[i] === prefix[j++];
}
j = 0;
n = i + m_hash.length;
// hash
for (i; i < n; i++) {
res &= decryptedSignature[i] === m_hash[j++];
}
if (!res) {
throw new SecurityError("Bad signature");
}
return this;
}
var RSA_OAEP_prototype = RSA_OAEP.prototype;

@@ -309,1 +435,6 @@ RSA_OAEP_prototype.reset = RSA_OAEP_reset;

RSA_PSS_prototype.verify = RSA_PSS_verify;
var RSA_PKCS1_v1_5_prototype = RSA_PKCS1_v1_5.prototype;
RSA_PKCS1_v1_5_prototype.reset = RSA_PKCS1_v1_5_reset;
RSA_PKCS1_v1_5_prototype.sign = RSA_PKCS1_v1_5_sign;
RSA_PKCS1_v1_5_prototype.verify = RSA_PKCS1_v1_5_verify;

@@ -0,2 +1,3 @@

import {RSA} from './rsa';
var RSA_RAW = RSA;
export default RSA;

@@ -1,2 +0,7 @@

function RSA ( options ) {
import {Modulus} from '../bignum/modulus';
import {BigNumber_constructor, is_big_number} from '../bignum/bignum';
import {is_buffer, is_bytes, is_string, string_to_bytes} from '../utils';
import {IllegalStateError} from '../errors';
export function RSA (options ) {
options = options || {};

@@ -10,3 +15,3 @@

function RSA_reset ( options ) {
export function RSA_reset ( options ) {
options = options || {};

@@ -25,5 +30,5 @@

k[0] = new Modulus( key[0] );
k[1] = new BigNumber( key[1] );
k[1] = new BigNumber_constructor( key[1] );
if ( l > 2 ) {
k[2] = new BigNumber( key[2] );
k[2] = new BigNumber_constructor( key[2] );
}

@@ -33,5 +38,5 @@ if ( l > 3 ) {

k[4] = new Modulus( key[4] );
k[5] = new BigNumber( key[5] );
k[6] = new BigNumber( key[6] );
k[7] = new BigNumber( key[7] );
k[5] = new BigNumber_constructor( key[5] );
k[6] = new BigNumber_constructor( key[6] );
k[7] = new BigNumber_constructor( key[7] );
}

@@ -49,3 +54,3 @@

function RSA_encrypt ( data ) {
export function RSA_encrypt ( data ) {
if ( !this.key )

@@ -62,3 +67,3 @@ throw new IllegalStateError("no key is associated with the instance");

if ( is_bytes(data) ) {
msg = new BigNumber(data);
msg = new BigNumber_constructor(data);
}

@@ -92,3 +97,3 @@ else if ( is_big_number(data) ) {

function RSA_decrypt ( data ) {
export function RSA_decrypt ( data ) {
if ( !this.key )

@@ -108,3 +113,3 @@ throw new IllegalStateError("no key is associated with the instance");

if ( is_bytes(data) ) {
msg = new BigNumber(data);
msg = new BigNumber_constructor(data);
}

@@ -111,0 +116,0 @@ else if ( is_big_number(data) ) {

@@ -1,4 +0,4 @@

var FloatArray = global.Float64Array || global.Float32Array; // make PhantomJS happy
export var FloatArray = typeof Float64Array !== "undefined" ? Float64Array : Float32Array; // make PhantomJS happy
function string_to_bytes ( str, utf8 ) {
export function string_to_bytes ( str, utf8 ) {
utf8 = !!utf8;

@@ -43,3 +43,3 @@

function hex_to_bytes ( str ) {
export function hex_to_bytes ( str ) {
var len = str.length;

@@ -57,7 +57,7 @@ if ( len & 1 ) {

function base64_to_bytes ( str ) {
export function base64_to_bytes ( str ) {
return string_to_bytes( atob( str ) );
}
function bytes_to_string ( bytes, utf8 ) {
export function bytes_to_string ( bytes, utf8 ) {
utf8 = !!utf8;

@@ -104,3 +104,3 @@

function bytes_to_hex ( arr ) {
export function bytes_to_hex ( arr ) {
var str = '';

@@ -115,7 +115,7 @@ for ( var i = 0; i < arr.length; i++ ) {

function bytes_to_base64 ( arr ) {
export function bytes_to_base64 ( arr ) {
return btoa( bytes_to_string(arr) );
}
function pow2_ceil ( a ) {
export function pow2_ceil ( a ) {
a -= 1;

@@ -131,19 +131,19 @@ a |= a >>> 1;

function is_number ( a ) {
export function is_number ( a ) {
return ( typeof a === 'number' );
}
function is_string ( a ) {
export function is_string ( a ) {
return ( typeof a === 'string' );
}
function is_buffer ( a ) {
export function is_buffer ( a ) {
return ( a instanceof ArrayBuffer );
}
function is_bytes ( a ) {
export function is_bytes ( a ) {
return ( a instanceof Uint8Array );
}
function is_typed_array ( a ) {
export function is_typed_array ( a ) {
return ( a instanceof Int8Array ) || ( a instanceof Uint8Array )

@@ -156,3 +156,3 @@ || ( a instanceof Int16Array ) || ( a instanceof Uint16Array )

function _heap_init ( constructor, options ) {
export function _heap_init ( constructor, options ) {
var heap = options.heap,

@@ -169,3 +169,3 @@ size = heap ? heap.byteLength : options.heapSize || 65536;

function _heap_write ( heap, hpos, data, dpos, dlen ) {
export function _heap_write ( heap, hpos, data, dpos, dlen ) {
var hlen = heap.length - hpos,

@@ -177,2 +177,2 @@ wlen = ( hlen < dlen ) ? hlen : dlen;

return wlen;
}
}

@@ -12,5 +12,6 @@ module("AES");

testIf( typeof AES_asm !== 'undefined', "Asm.js module", function () {
AES_asm = AES_asm.AES_asm;
var heap = new Uint8Array(65536);
var keys = new Uint32Array(heap.buffer);
var aes = AES_asm( window, null, heap.buffer );
var aes = AES_asm( null, heap.buffer );

@@ -17,0 +18,0 @@ // data block

@@ -0,0 +0,0 @@ module("BigNumber");

@@ -0,0 +0,0 @@ module("dummy");

@@ -0,0 +0,0 @@ /*

@@ -0,0 +0,0 @@ module("RSA");

@@ -0,0 +0,0 @@ module("SHA1");

@@ -0,0 +0,0 @@ module("SHA256");

@@ -0,0 +0,0 @@ module("SHA512");

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc