/* Rexx Crypt()
 * Copyright (C) 1998 by Dmitry A.Steklenev
 */

call rxFuncAdd "Crypt", "RxCrypt", "RxCrypt"

itoa64 = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
salt   = ""

do i = 1 to 8
   salt = salt || substr( itoa64, random( 0, 63 ) + 1, 1 )
end

call charout ,"Enter password     : "
parse pull passone
passone = Crypt( passone, salt )

say "Encrypted password : "passone

call charout ,"Re-enter password  : "
parse pull passtwo
passtwo = Crypt( passtwo, passone )

if passtwo == passone then
   say "Password test passed"
else
   say "Password mismatch"


