This commit is contained in:
2026-04-25 16:36:34 +08:00
commit db90e7579b
1876 changed files with 189777 additions and 0 deletions

View File

@@ -0,0 +1,9 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`des encrypt D 1`] = `"ihmnn4VBPYE="`;
exports[`des encrypt bar 1`] = `"p/PIC32MPm4="`;
exports[`des encrypt foo 1`] = `"NP3+ABhEiY4="`;
exports[`des encrypt 你 1`] = `"O5kF0LXzjpE="`;

View File

@@ -0,0 +1,17 @@
import { desEncrypt, desDecrypt } from '../des';
describe('des', () => {
const key = '12345678';
describe('encrypt', () => {
test.each([['foo'], ['bar'], ['你'], ['D']])('%s', (input) => {
expect(desEncrypt(input, key)).toMatchSnapshot();
});
});
describe('decrypt', () => {
test.each([['foo'], ['bar'], ['你'], ['D']])('%s', (input) => {
expect(desDecrypt(desEncrypt(input, key), key)).toBe(input);
});
});
});