22 lines
505 B
Rexx
22 lines
505 B
Rexx
/* Rexx */
|
|
Call RxFuncAdd 'SysCrypt', 'rxunixsys','SysCrypt'
|
|
|
|
my_msg = "This is a test message I would like to encrypt"
|
|
my_salt = get_salt(16) /* the width of the salt. E.g. 16 is for SHA-512 */
|
|
enc_msg = SysCrypt(my_msg, my_salt)
|
|
|
|
Say "My Message: " || my_msg
|
|
Say "Salt: " || salt
|
|
Say "Encrypted: " || enc_msg
|
|
|
|
exit
|
|
|
|
get_salt:
|
|
parse arg width
|
|
salt = ""
|
|
Loop x = 1 to width
|
|
chr = d2c(random(65,90)) /* Alpha Chars A...Z */
|
|
salt = salt || chr
|
|
End /* loop */
|
|
return salt
|