Skip to content

Commit

Permalink
feat: 类型报错优化
Browse files Browse the repository at this point in the history
  • Loading branch information
GavinLucky committed Nov 7, 2024
1 parent ffc4d93 commit 8d5002a
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 57 deletions.
1 change: 0 additions & 1 deletion playground/src/views/demos/features/crypto/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ watch(
doAesEncryptFn();
},
{
debounce: 300,
immediate: true,
},
);
Expand Down
56 changes: 0 additions & 56 deletions playground/src/views/demos/features/crypto/inner/CryptoHooks.ts
Original file line number Diff line number Diff line change
@@ -1,61 +1,5 @@
import { CryptoJS } from '@vben/utils';

export function hashingFn1(inputMessage: string, type: string) {
const algorithms = type;

let hashingOutput;
switch (algorithms) {
case 'MD5': {
hashingOutput = CryptoJS.MD5(inputMessage);
break;
}
case 'RIPEMD160': {
hashingOutput = CryptoJS.RIPEMD160(inputMessage);
break;
}
case 'SHA1': {
hashingOutput = CryptoJS.SHA1(inputMessage);
break;
}
case 'SHA224': {
hashingOutput = CryptoJS.SHA224(inputMessage);
break;
}
case 'SHA256': {
hashingOutput = CryptoJS.SHA256(inputMessage);
break;
}
case 'SHA384': {
hashingOutput = CryptoJS.SHA384(inputMessage);
break;
}
case 'SHA512': {
hashingOutput = CryptoJS.SHA512(inputMessage);
break;
}
case 'SHA3224': {
hashingOutput = CryptoJS.SHA3(inputMessage, { outputLength: 224 });
break;
}
case 'SHA3256': {
hashingOutput = CryptoJS.SHA3(inputMessage, { outputLength: 256 });
break;
}
case 'SHA3384': {
hashingOutput = CryptoJS.SHA3(inputMessage, { outputLength: 384 });
break;
}
case 'SHA3512': {
hashingOutput = CryptoJS.SHA3(inputMessage, { outputLength: 512 });
break;
}
default: {
hashingOutput = '';
}
}
return hashingOutput.toString();
}

type HashAlgorithm =
| 'MD5'
| 'RIPEMD160'
Expand Down

0 comments on commit 8d5002a

Please sign in to comment.