bigriver
Advanced tools
Comparing version 1.1.1 to 1.1.2
/// <reference types="node" /> | ||
import { BinaryToTextEncoding } from 'crypto'; | ||
export declare const highwayHashGenerator: (seed?: Buffer | undefined) => (str: string) => string; | ||
export declare const useHighwayHash: (seed?: Buffer | undefined) => (str: string) => string; | ||
export declare const sha1: (str: string | Buffer, encoding?: BinaryToTextEncoding) => string; | ||
@@ -5,0 +5,0 @@ export declare const sha256: (str: string | Buffer, encoding?: BinaryToTextEncoding) => string; |
@@ -6,10 +6,10 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.hashPassword = exports.md5 = exports.sha256 = exports.sha1 = exports.highwayHashGenerator = void 0; | ||
exports.hashPassword = exports.md5 = exports.sha256 = exports.sha1 = exports.useHighwayHash = void 0; | ||
const crypto_1 = require("crypto"); | ||
const highwayhash_1 = __importDefault(require("highwayhash")); | ||
const highwayHashGenerator = (seed) => { | ||
const useHighwayHash = (seed) => { | ||
const hashKey = seed !== null && seed !== void 0 ? seed : crypto_1.pseudoRandomBytes(32); | ||
return (str) => highwayhash_1.default.asHexString(hashKey, Buffer.from(str)); | ||
}; | ||
exports.highwayHashGenerator = highwayHashGenerator; | ||
exports.useHighwayHash = useHighwayHash; | ||
const sha1 = (str, encoding = 'hex') => crypto_1.createHash('sha1').update(str).digest(encoding); | ||
@@ -16,0 +16,0 @@ exports.sha1 = sha1; |
{ | ||
"name": "bigriver", | ||
"version": "1.1.1", | ||
"version": "1.1.2", | ||
"description": "A fast well-typed back-end prototyping framework", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
import { createHash, BinaryToTextEncoding, pseudoRandomBytes } from 'crypto' | ||
import highwayhash from 'highwayhash' | ||
export const highwayHashGenerator = (seed?: Buffer) => { | ||
export const useHighwayHash = (seed?: Buffer) => { | ||
const hashKey = seed ?? pseudoRandomBytes(32) | ||
@@ -6,0 +6,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
186495