@@ -31,57 +31,57 @@ export const generate_murmur_hash = {
31
31
} ,
32
32
}
33
33
34
- export function generateMurmurHash ( source : GenerateMurmurHash ) {
35
- const { input, seed, version } = GenerateMurmurHashModel . parse ( source )
36
- if ( version === '2' ) {
37
- return murmurhash . v2 ( input , seed )
38
- }
39
- return murmurhash . v3 ( input , seed )
40
- }
34
+ // export function generateMurmurHash(source: GenerateMurmurHash) {
35
+ // const { input, seed, version } = GenerateMurmurHashModel.parse(source)
36
+ // if (version === '2') {
37
+ // return murmurhash.v2(input, seed)
38
+ // }
39
+ // return murmurhash.v3(input, seed)
40
+ // }
41
41
42
- export const get_random_bytes = {
43
- form : 'form' ,
44
- link : {
45
- size : { like : 'natural_number' } ,
46
- } ,
47
- }
42
+ // export const get_random_bytes = {
43
+ // form: 'form',
44
+ // link: {
45
+ // size: { like: 'natural_number' },
46
+ // },
47
+ // }
48
48
49
- // var key = forge.random.getBytesSync(16)
50
- // var iv = forge.random.getBytesSync(16)
51
- export async function getRandomBytes ( source : GetRandomBytes ) {
52
- return new Promise ( ( res , rej ) => {
53
- return forge . random . getBytes (
54
- source . size ,
55
- ( err : Error | null , bytes ) => {
56
- if ( err ) {
57
- return rej ( err )
58
- }
59
- return res ( bytes )
60
- } ,
61
- )
62
- } )
63
- }
49
+ // // var key = forge.random.getBytesSync(16)
50
+ // // var iv = forge.random.getBytesSync(16)
51
+ // export async function getRandomBytes(source: GetRandomBytes) {
52
+ // return new Promise((res, rej) => {
53
+ // return forge.random.getBytes(
54
+ // source.size,
55
+ // (err: Error | null, bytes) => {
56
+ // if (err) {
57
+ // return rej(err)
58
+ // }
59
+ // return res(bytes)
60
+ // },
61
+ // )
62
+ // })
63
+ // }
64
64
65
- export const encrypt_bytes_with_aes = {
66
- form : 'form' ,
67
- link : {
68
- mode : { like : 'string' } ,
69
- } ,
70
- }
65
+ // export const encrypt_bytes_with_aes = {
66
+ // form: 'form',
67
+ // link: {
68
+ // mode: { like: 'string' },
69
+ // },
70
+ // }
71
71
72
- export async function encryptBytesWithAes ( source : EncryptBytesWithAes ) {
73
- const cipher = forge . cipher . createCipher ( `AES-${ mode } ` , key )
74
- cipher . start ( { iv : iv } )
75
- cipher . update ( forge . util . createBuffer ( input ) )
76
- cipher . finish ( )
77
- return cipher . output . bytes ( )
78
- }
72
+ // export async function encryptBytesWithAes(source: EncryptBytesWithAes) {
73
+ // const cipher = forge.cipher.createCipher(`AES-${mode}`, key)
74
+ // cipher.start({ iv: iv })
75
+ // cipher.update(forge.util.createBuffer(input))
76
+ // cipher.finish()
77
+ // return cipher.output.bytes()
78
+ // }
79
79
80
- export async function decryptBytesWithAes ( ) {
81
- const decipher = forge . cipher . createDecipher ( `AES-${ mode } ` , key )
82
- decipher . start ( { iv : iv } )
83
- decipher . update ( input ) // input == encryptedBytes
84
- if ( decipher . finish ( ) ) {
85
- return decipher . output . bytes ( )
86
- }
87
- }
80
+ // export async function decryptBytesWithAes() {
81
+ // const decipher = forge.cipher.createDecipher(`AES-${mode}`, key)
82
+ // decipher.start({ iv: iv })
83
+ // decipher.update(input) // input == encryptedBytes
84
+ // if (decipher.finish()) {
85
+ // return decipher.output.bytes()
86
+ // }
87
+ // }
0 commit comments