Where is the bug?
Posted: 07 Mar 2013 11:50
I did keypad for 14 characters and it worked, but when I made a shorter version not display the hashes on the end. There is the code:
Count the characters, save the hashes but does not display them afterwards. Does you know how to fix it ?
Code: Select all
@echo off
chcp 1250 > nul
color 0a
:liczenie0
cls
SETLOCAL ENABLEDELAYEDEXPANSION
set /p str=Podaj hasło:
set len=0
FOR %%a in (%str%) do ( set str3=%%a
call :liczenie1 %%a)
Exit /b
:liczenie1
set str2=!str3:~%len%,1!
if "%str2%"=="" ( call :liczenie2 ) ELSE (
set /a len=%len%+1
call :liczenie1 %str3% )
Exit /b
:liczenie2
cls
:szyfrowanie0
IF %len% GEQ 1 set s1=%str:~0,1%
IF %len% GEQ 2 set s2=%str:~1,1%
IF %len% GEQ 3 set s3=%str:~2,1%
IF %len% GEQ 4 set s4=%str:~3,1%
IF %len% GEQ 5 set s5=%str:~4,1%
IF %len% GEQ 6 set s6=%str:~5,1%
IF %len% GEQ 7 set s7=%str:~6,1%
IF %len% GEQ 8 set s8=%str:~7,1%
IF %len% GEQ 9 set s9=%str:~8,1%
IF %len% GEQ 10 set s10=%str:~9,1%
IF %len% GEQ 11 set s11=%str:~10,1%
IF %len% GEQ 12 set s12=%str:~11,1%
IF %len% GEQ 13 set s13=%str:~12,1%
IF %len% GEQ 14 set s14=%str:~13,1%
IF %len% GEQ 15 goto liczenie0
set c=0
:hashset
set /a c=%c%+1
:szyfrowanie1
IF s%c%==9 set hash%c%=A
IF s%c%==Q set hash%c%=B
IF s%c%==8 set hash%c%=C
IF s%c%==x set hash%c%=D
IF s%c%==7 set hash%c%=E
IF s%c%==Z set hash%c%=F
IF s%c%==6 set hash%c%=G
IF s%c%==y set hash%c%=H
IF s%c%==5 set hash%c%=I
IF s%c%==W set hash%c%=J
IF s%c%==4 set hash%c%=K
IF s%c%==u set hash%c%=L
IF s%c%==3 set hash%c%=M
IF s%c%==T set hash%c%=N
IF s%c%==2 set hash%c%=O
IF s%c%==s set hash%c%=P
IF s%c%==1 set hash%c%=R
IF s%c%==R set hash%c%=S
IF s%c%==0 set hash%c%=T
IF s%c%==p set hash%c%=U
IF s%c%==/ set hash%c%=W
IF s%c%==O set hash%c%=Y
IF s%c%==n set hash%c%=X
IF s%c%==_ set hash%c%=Q
IF s%c%==M set hash%c%=a
IF s%c%==q set hash%c%=b
IF s%c%==l set hash%c%=c
IF s%c%==X set hash%c%=d
IF s%c%==K set hash%c%=e
IF s%c%==z set hash%c%=f
IF s%c%==j set hash%c%=g
IF s%c%==Y set hash%c%=h
IF s%c%==I set hash%c%=i
IF s%c%==w set hash%c%=j
IF s%c%==h set hash%c%=k
IF s%c%==U set hash%c%=l
IF s%c%==G set hash%c%=m
IF s%c%==t set hash%c%=n
IF s%c%==f set hash%c%=o
IF s%c%==S set hash%c%=p
IF s%c%==E set hash%c%=r
IF s%c%==r set hash%c%=s
IF s%c%==d set hash%c%=t
IF s%c%==P set hash%c%=u
IF s%c%==C set hash%c%=w
IF s%c%==o set hash%c%=y
IF s%c%==b set hash%c%=z
IF s%c%==N set hash%c%=x
IF s%c%==A set hash%c%=q
IF s%c%==, set hash%c%=1
IF s%c%==0 set hash%c%=2
IF s%c%==8 set hash%c%=3
IF s%c%==6 set hash%c%=4
IF s%c%==4 set hash%c%=5
IF s%c%==2 set hash%c%=6
IF s%c%==_ set hash%c%=7
IF s%c%==/ set hash%c%=8
IF s%c%==9 set hash%c%=9
IF s%c%==7 set hash%c%=0
IF s%c%==5 set hash%c%=/
IF s%c%==3 set hash%c%=,
IF s%c%==1 set hash%c%=_
:sprawdzenie
set /a b=%c%+1
IF not %len% GEQ %b% goto koniec
IF %len% GEQ %b% goto hashset
:koniec
echo Hash: %hash1%%hash2%%hash3%%hash3%%hash4%%hash5%%hash6%%hash7%%hash8%%hash9%%hash10%%hash11%%hash12%%hash13%%hash14%
pause > nul
Count the characters, save the hashes but does not display them afterwards. Does you know how to fix it ?