How to store passwords encrypted for calling during batch processing?
[ Last edited by uiopuiop on 2011-1-10 at 23:58 ]
[ Last edited by uiopuiop on 2011-1-10 at 23:58 ]
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!
@echo off&setlocal enabledelayedexpansion
set x0=!random!!random!!random!!random!!random!&echo !x0! original
set r=hkcu\Software\hanye
:x1: encryption algorithm
if not "!x0:~%n%,1!"=="" set/a a=!x0:~%n%,1!+!n:~-1!,n+=1&set x1=!x1!!a:~-1!&goto:x1
echo %x1% encrypted
reg add %r% /ve /d %x1% /f>nul
for /f "tokens=3 delims=这里是制符" %%a in ('reg query %r% /ve') do set x3=%%a
:x2: decryption algorithm
if not "!x3:~%m%,1!"=="" set/a a=1!x3:~%m%,1!-!m:~-1!,m+=1&set x2=!x2!!a:~-1!&goto:x2
echo %x2% decrypted
pause
reg delete %r% /f>nulOriginally posted by Hanyeguxing at 2011-1-11 12:35 AM:
What are the password rules? Pure numbers? Numbers plus letters? Or common characters?
What are the requirements for the encryption algorithm?
Where is the storage location specified? In the registry or in a file?
Originally posted by slore at 2011-1-12 01:43 PM:
Add more, cancel the if...
The written bat code, most core operations depend on the password.
Then encrypt the password with MD5 and compare it in the bat. If it is correct, execute...
So seeing your...
Originally posted by uiopuiop at 2011-1-12 23:37:
Most automated scripts run automatically without manual intervention, so passwords cannot be entered manually.
After you encrypt with MD5, how do you decrypt it? The password must be in plain text when the batch file runs. It must be decrypted and then passed to the corresponding command during execution. MD5 can't recognize it.