加密解密
内置 加密解密 工具函数
函数名 | 描述 | 类型 | 参数 | 返回值 |
---|---|---|---|---|
MD5 | MD5加密 | (content:string)=> string | (content:string) | String |
base64 | Base64编码 | (content:string)=> string | (content:string) | String |
unBase64 | Base64解码 | (content:string)=> string | (content:string) | String |
RSA | 非对称加密(RSA密钥对生成工具) | (content:string,key:string)=> string | (content:string,key:string) | String |
unRSA | 非对称解密 | (content:string,key:string)=> string | (content:string,key:string) | String |
AES | 对称加密 | (content:string,key:string)=> string | (content:string,key:string) | String |
unAES | 对称解密 | (content:string,key:string)=> string | (content:string,key:string) | String |
示例
函数名 | 例子 | 返回值 |
---|---|---|
MD5 | MD5('Abc') | 35593b7ce5020eae3ca68fd5b6f3e031 |
base64 | base64('Abc') | QWJj |
unBase64 | unBase64(base64('Abc')) | Abc |
RSA | RSA('abc') | RiLRlFiNz1z4KD/hJcAHrveShPZVYhi2PyRyZ/XwSawT7FEId7won2EnS4BA5X4t3uaAqJ06rkxE0uS9Yk0+zQ== |
unRSA | unRSA(RSA('abc')) | abc |
AES | AES('abc', 'aaa') | U2FsdGVkX1/txNtGCUtJnEljeZESj9g6OtXpDNsg7Bs= |
unAES | unAES(AES('abc', 'a'), 'a') | abc |
<template>
<div>
<config-table title="加密解密例子" :list="list"></config-table>
</div>
</template>
<script setup lang="ts">
import { MD5, base64, unBase64, RSA, unRSA, AES, unAES } from '@vtj/utils';
import ConfigTable from '$/components/configTable.vue';
const RSAVal: string = RSA('abc') as string;
const AESVal = AES('abc', 'a');
const val = unAES(AESVal, 'a');
const list: any[] = [
{ name: 'MD5', example: "MD5('Abc')", return: MD5('Abc') },
{ name: 'base64', example: "base64('Abc')", return: base64('Abc') },
{
name: 'unBase64',
example: "unBase64(base64('Abc'))",
return: unBase64(base64('Abc'))
},
{
name: 'RSA',
example: "RSA('abc')",
return: RSA('abc')
},
{
name: 'unRSA',
example: "unRSA(RSA('abc'))",
return: unRSA(RSAVal)
},
{
name: 'AES',
example: " AES('abc', 'aaa') ",
return: AES('abc', 'aaa')
},
{
name: 'unAES',
example: "unAES(AES('abc', 'a'), 'a')",
return: val
}
];
</script>