initital commit

This commit is contained in:
fengachen
2021-09-15 09:58:01 +08:00
commit d46f96d263
90 changed files with 17509 additions and 0 deletions
@@ -0,0 +1,13 @@
Crypto = (require '../cryptojs').Crypto
key = '12345678'
us = 'Hello, 世界!'
mode = new Crypto.mode.ECB Crypto.pad.pkcs7
console.log "ub = #{ub = Crypto.charenc.UTF8.stringToBytes us}"
console.log "eb = #{eb = Crypto.DES.encrypt ub, key, {asBytes: true, mode: mode}}"
console.log "ehs= #{ehs= Crypto.util.bytesToHex eb}"
console.log "eb2= #{eb2= Crypto.util.hexToBytes ehs}"
console.log "ub2= #{ub2= Crypto.DES.decrypt eb2, key, {asBytes: true, mode: mode}}"
console.log "us2= #{us2= Crypto.charenc.UTF8.bytesToString ub2}"