uni app使用DES加密解密資料

2022-04-20 10:11:12 字數 1015 閱讀 4786

(1) 開啟hbuilderx的檢視->顯示終端

cd 切換到你專案的根目錄

執行命令 npm install crypto-js

安裝成功後你的專案根目錄會生成node_modules資料夾,裡面有crypto-js就說明成功了

(2)接下來在哪使用就直接import cryptojs from './node_modules/crypto-js/crypto-js.js'引入就可以了

(3)封裝函式

明天再寫。。。忘記了; 現在補充

我把crypto-js/crypto-js.js拷貝到了common目錄下,並在下面新建了個js檔案,寫入下面**;

import cryptojs from './crypto-js/crypto-js.js'

/*des(data encryption standard)和tripledes是對稱加密的兩種實現。

des和tripledes基本演算法一致,只是tripledes演算法提供的key位數更多,加密可靠性更高。

des使用的金鑰key為8位元組,初始向量iv也是8位元組。

tripledes使用24位元組的key,初始向量iv也是8位元組。

*///

des加密 des-ede3-cbc

var keyvi = '12345678';

function

des_encrypt(message) );

return

encode_str.tostring();}//

des解密 des-ede3-cbc

function

des_decrypt(message)

);

return

decrypt_str.tostring(cryptojs.enc.utf8);

}module.exports =

DES加密解密

using system using system.drawing using system.collections using system.componentmodel using system.windows.forms using system.data using system.io us...

DES加密解密

加密類 date 2012 04 23 pm.public class encrypt private encrypt 建立加密類物件.public static encrypt createcryptoserviceprovider des加密.待加密字串.加密金鑰.8位 public strin...

DES加密解密

using system.data using system.configuration using system.web using system.web.security using system.web.ui using system.web.ui.webcontrols using syst...