File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- import { createHash } from "../environment/index.js" ;
1+ import { environment } from "../environment/index.js" ;
22import { fixBufferLength } from "../util.js" ;
33
44export function hash ( algorithm : string , buffers : Buffer [ ] , length ?: number ) : Buffer {
5- const digest = createHash ( algorithm ) ;
5+ const digest = environment . createHash ( algorithm ) ;
66
77 for ( const buffer of buffers ) {
88 digest . update ( buffer ) ;
Original file line number Diff line number Diff line change 11import browserifyAES from "browserify-aes/browser.js" ;
22import { inflate as pakoInflate } from "pako" ;
33import type { Environment } from "./types.js" ;
4-
5- export { default as createHash } from "create-hash" ;
4+ import { default as createHash } from "create-hash" ;
65
76export const environment : Environment = {
87 inflate : ( data ) => Buffer . from ( pakoInflate ( data ) ) ,
98 createDecipheriv : browserifyAES . createDecipheriv ,
9+ createHash,
1010} ;
Original file line number Diff line number Diff line change 1+ import { createDecipheriv , createHash } from "node:crypto" ;
12import { inflateSync } from "node:zlib" ;
23import type { Environment } from "./types.js" ;
3- import { createDecipheriv } from "crypto" ;
4-
5- export { createHash } from "crypto" ;
64
75export const environment : Environment = {
86 inflate : ( data ) => inflateSync ( data ) ,
97 createDecipheriv,
8+ createHash,
109} ;
Original file line number Diff line number Diff line change 11export type Environment = {
22 inflate : ( data : Buffer ) => Buffer ;
33 createDecipheriv : ( algorithm : string , key : Buffer , iv : Buffer ) => Decipher ;
4+ createHash : ( algorithm : string ) => Hash ;
45} ;
56
67export type Decipher = {
78 setAutoPadding : ( padding : boolean ) => void ;
89 update : ( data : Buffer ) => Buffer ;
910} ;
11+
12+ export type Hash = {
13+ update : ( data : Buffer ) => void ;
14+ digest : ( ) => Buffer ;
15+ } ;
You can’t perform that action at this time.
0 commit comments