| Posted: 10:56pm 22 Dec 2024 |
|
|
|
@Peter Thanks. Works! I'm just wondering how MATH AES DECRYPT detects if the message was sent with or without IV, hence my confusion. Michael
I'm guessing it sets a flag in the output file?
' Peters aes demo program for Picomites ' modified for ascii input by twofingers@TBS Option explicit CLS Const iv_enabled = 1 ' IV on/OFF <<<<<<<<<<<<<------------------- Dim string in$="",out$="",comp$="" Dim integer i Dim key$ ="0123456789ABCDEF" 'Your "Password" Dim IV$ ="0123456789012345" 'initialisation vector 'convert the message to a string version of the message Print Input "Your message (max 224): ", in$ Inc in$,String$((16-Len(in$) Mod 16)Mod 16,0) ' encrypt the message If iv_enabled Then Math aes128 encrypt ctr key$,in$,out$,iv$ Else Math aes128 encrypt ctr key$,in$,out$ 'without initialisation vector EndIf
'decrypt the message Math aes128 decrypt ctr key$,out$,comp$ '
Print ">"comp$"<" 'check for errors If in$<>comp$ Then Print "WTF" Else Print "Okay" End Edited 2024-12-23 09:09 by twofingers |