Socket
Socket
Sign inDemoInstall

@noble/hashes

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@noble/hashes - npm Package Compare versions

Comparing version 1.1.4 to 1.1.5

3

_sha2.js

@@ -87,6 +87,7 @@ "use strict";

const len = this.outputLen;
// NOTE: we do division by 4 later, which should be fused in single op with modulo by JIT
if (len % 4)
throw new Error('_sha2: outputLen should be aligned to 32bit');
const outLen = len / 4;
const state = this.get();
const outLen = len / 4;
if (outLen > state.length)

@@ -93,0 +94,0 @@ throw new Error('_sha2: outputLen bigger than state');

@@ -84,6 +84,7 @@ import assert from './_assert.js';

const len = this.outputLen;
// NOTE: we do division by 4 later, which should be fused in single op with modulo by JIT
if (len % 4)
throw new Error('_sha2: outputLen should be aligned to 32bit');
const outLen = len / 4;
const state = this.get();
const outLen = len / 4;
if (outLen > state.length)

@@ -90,0 +91,0 @@ throw new Error('_sha2: outputLen bigger than state');

@@ -103,2 +103,17 @@ import { SHA2 } from './_sha2.js';

}
// Constants from https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.180-4.pdf
class SHA224 extends SHA256 {
constructor() {
super();
this.A = 0xc1059ed8 | 0;
this.B = 0x367cd507 | 0;
this.C = 0x3070dd17 | 0;
this.D = 0xf70e5939 | 0;
this.E = 0xffc00b31 | 0;
this.F = 0x68581511 | 0;
this.G = 0x64f98fa7 | 0;
this.H = 0xbefa4fa4 | 0;
this.outputLen = 28;
}
}
/**

@@ -109,1 +124,2 @@ * SHA2-256 hash function

export const sha256 = wrapConstructor(() => new SHA256());
export const sha224 = wrapConstructor(() => new SHA224());

@@ -158,2 +158,25 @@ import { SHA2 } from './_sha2.js';

}
class SHA512_224 extends SHA512 {
constructor() {
super();
// h -- high 32 bits, l -- low 32 bits
this.Ah = 0x8c3d37c8 | 0;
this.Al = 0x19544da2 | 0;
this.Bh = 0x73e19966 | 0;
this.Bl = 0x89dcd4d6 | 0;
this.Ch = 0x1dfab7ae | 0;
this.Cl = 0x32ff9c82 | 0;
this.Dh = 0x679dd514 | 0;
this.Dl = 0x582f9fcf | 0;
this.Eh = 0x0f6d2b69 | 0;
this.El = 0x7bd44da8 | 0;
this.Fh = 0x77e36f73 | 0;
this.Fl = 0x04c48942 | 0;
this.Gh = 0x3f9d85a8 | 0;
this.Gl = 0x6a1d36c8 | 0;
this.Hh = 0x1112e6ad | 0;
this.Hl = 0x91d692a1 | 0;
this.outputLen = 28;
}
}
class SHA512_256 extends SHA512 {

@@ -206,3 +229,4 @@ constructor() {

export const sha512 = wrapConstructor(() => new SHA512());
export const sha512_224 = wrapConstructor(() => new SHA512_224());
export const sha512_256 = wrapConstructor(() => new SHA512_256());
export const sha384 = wrapConstructor(() => new SHA384());
{
"name": "@noble/hashes",
"version": "1.1.4",
"version": "1.1.5",
"description": "Audited & minimal 0-dependency JS implementation of SHA2, SHA3, RIPEMD, BLAKE2/3, HMAC, HKDF, PBKDF2, Scrypt",

@@ -5,0 +5,0 @@ "files": [

import { SHA2 } from './_sha2.js';
declare class SHA256 extends SHA2<SHA256> {
private A;
private B;
private C;
private D;
private E;
private F;
private G;
private H;
A: number;
B: number;
C: number;
D: number;
E: number;
F: number;
G: number;
H: number;
constructor();

@@ -28,2 +28,8 @@ protected get(): [number, number, number, number, number, number, number, number];

};
export declare const sha224: {
(message: import("./utils.js").Input): Uint8Array;
outputLen: number;
blockLen: number;
create(): import("./utils.js").Hash<SHA256>;
};
export {};
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.sha256 = void 0;
exports.sha224 = exports.sha256 = void 0;
const _sha2_js_1 = require("./_sha2.js");

@@ -106,2 +106,17 @@ const utils_js_1 = require("./utils.js");

}
// Constants from https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.180-4.pdf
class SHA224 extends SHA256 {
constructor() {
super();
this.A = 0xc1059ed8 | 0;
this.B = 0x367cd507 | 0;
this.C = 0x3070dd17 | 0;
this.D = 0xf70e5939 | 0;
this.E = 0xffc00b31 | 0;
this.F = 0x68581511 | 0;
this.G = 0x64f98fa7 | 0;
this.H = 0xbefa4fa4 | 0;
this.outputLen = 28;
}
}
/**

@@ -112,1 +127,2 @@ * SHA2-256 hash function

exports.sha256 = (0, utils_js_1.wrapConstructor)(() => new SHA256());
exports.sha224 = (0, utils_js_1.wrapConstructor)(() => new SHA224());

@@ -49,2 +49,8 @@ import { SHA2 } from './_sha2.js';

};
export declare const sha512_224: {
(message: import("./utils.js").Input): Uint8Array;
outputLen: number;
blockLen: number;
create(): import("./utils.js").Hash<SHA512>;
};
export declare const sha512_256: {

@@ -51,0 +57,0 @@ (message: import("./utils.js").Input): Uint8Array;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.sha384 = exports.sha512_256 = exports.sha512 = exports.SHA512 = void 0;
exports.sha384 = exports.sha512_256 = exports.sha512_224 = exports.sha512 = exports.SHA512 = void 0;
const _sha2_js_1 = require("./_sha2.js");

@@ -162,2 +162,25 @@ const _u64_js_1 = require("./_u64.js");

exports.SHA512 = SHA512;
class SHA512_224 extends SHA512 {
constructor() {
super();
// h -- high 32 bits, l -- low 32 bits
this.Ah = 0x8c3d37c8 | 0;
this.Al = 0x19544da2 | 0;
this.Bh = 0x73e19966 | 0;
this.Bl = 0x89dcd4d6 | 0;
this.Ch = 0x1dfab7ae | 0;
this.Cl = 0x32ff9c82 | 0;
this.Dh = 0x679dd514 | 0;
this.Dl = 0x582f9fcf | 0;
this.Eh = 0x0f6d2b69 | 0;
this.El = 0x7bd44da8 | 0;
this.Fh = 0x77e36f73 | 0;
this.Fl = 0x04c48942 | 0;
this.Gh = 0x3f9d85a8 | 0;
this.Gl = 0x6a1d36c8 | 0;
this.Hh = 0x1112e6ad | 0;
this.Hl = 0x91d692a1 | 0;
this.outputLen = 28;
}
}
class SHA512_256 extends SHA512 {

@@ -210,3 +233,4 @@ constructor() {

exports.sha512 = (0, utils_js_1.wrapConstructor)(() => new SHA512());
exports.sha512_224 = (0, utils_js_1.wrapConstructor)(() => new SHA512_224());
exports.sha512_256 = (0, utils_js_1.wrapConstructor)(() => new SHA512_256());
exports.sha384 = (0, utils_js_1.wrapConstructor)(() => new SHA384());
SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc