MCPcopy Create free account
hub / github.com/msgbyte/tailchat / desDecrypt

Function desDecrypt

server/lib/crypto/des.ts:16–24  ·  view source on GitHub ↗
(text: string, key: string = config.secret)

Source from the content-addressed store, hash-verified

14
15// DES 解密
16export function desDecrypt(text: string, key: string = config.secret) {
17 key =
18 key.length >= 8 ? key.slice(0, 8) : key.concat('0'.repeat(8 - key.length));
19 const keyHex = new Buffer(key);
20 const cipher = crypto.createDecipheriv('des-cbc', keyHex, keyHex);
21 let c = cipher.update(text, 'base64', 'utf8');
22 c += cipher.final('utf8');
23 return c;
24}

Callers 1

des.spec.tsFile · 0.90

Calls 1

updateMethod · 0.80

Tested by

no test coverage detected