Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords: Encrypt Hide Password Decrypt Simple Text String
Although it is easier now than it was in the past, there is still a significant paperwork burden to support good encryption.
This does not mean WinBatch cannot do it, it just kinds of means we don't really want to supply the direct means to do it. So you get to write your own udfs.....
The following code is not high security but is does stop the average user.
;The following code is not high security but is does stop the average user. #DefineFunction EncryptStr( pwd ) ;******************************* ; Encrypt Password ;******************************* b = StrLen( pwd ) aa = b : "@" : pwd b = StrLen(aa) aa = aa : "JKHJY&GY&RTFUI&YGRDRDTYY*()&*(&*GYGGYR" aa = StrFix( aa, "&GG&^R^$", b ) np = "" For x=1 To b xx = Char2Num( StrSub( aa, x, 1 ) ) xx = xx + 125 np = np : Num2Char(xx) Next pwd = ChrStringToHex( np) Return pwd #EndFunction #DefineFunction DecryptStr( pwd ) ;******************************* ; Decrypt Password ;******************************* np = ChrHexToString( pwd ) b = StrLen( np ) orig="" For x=1 To b xx = Char2Num( StrSub( np, x, 1 ) ) xx = xx-125 orig = orig : Num2Char(xx) Next ;ChrHexToString s1 = ItemExtract( 1, orig, "@" ) pwd = StrSub( orig, StrLen( s1 ) + 2, -1 ) Return pwd #EndFunction ;******************************* ; Test ;******************************* pwd = '527532' pswd = 'abcdefghijklmnopqrstuvwxyz0123456789' encrypted_pswd = EncryptStr( pswd ) Pause( 'Encrypted password', encrypted_pswd ) decrypted_pswd = DecryptStr( encrypted_pswd ) Pause( 'Decrypted password', decrypted_pswd ) Exit
Article ID: W16029
File Created: 2014:07:18:09:51:38
Last Updated: 2014:07:18:09:51:38