Skip to content

Commit

Permalink
Added Rabbit cypher for encryption (#486)
Browse files Browse the repository at this point in the history
  • Loading branch information
lpeyr committed Aug 5, 2023
1 parent 0d209b8 commit dd877e1
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions pages/encryption.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ export default function EncryptionPage() {
}
LoadSettings()

let algo = settings.encryptAlgo
const [algo, setAlgo] = useState(settings.encryptAlgo)

function SelectChanged(val) {
algo = val
setAlgo(val)
}

const [text, setText] = useState("")
Expand All @@ -56,7 +56,11 @@ export default function EncryptionPage() {
break
case "3des":
setEncrypted(CryptoJS.TripleDES.encrypt(text, key))

break
case "rabbit":
setEncrypted(CryptoJS.Rabbit.encrypt(text, key))
alert(algo)
break
default:
break
}
Expand All @@ -71,7 +75,10 @@ export default function EncryptionPage() {
setD_Encrypted(
hex2a(CryptoJS.TripleDES.decrypt(d_text, d_key).toString())
)

break
case "rabbit":
setD_Encrypted(hex2a(CryptoJS.Rabbit.decrypt(d_text, d_key).toString()))
break
default:
break
}
Expand Down Expand Up @@ -125,6 +132,7 @@ export default function EncryptionPage() {
AES
</SelectItem>
<SelectItem value="3des">3DES</SelectItem>
<SelectItem value="rabbit">Rabbit</SelectItem>
</SelectContent>
</Select>
</TabsList>
Expand Down

0 comments on commit dd877e1

Please sign in to comment.