Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;Forum: https://forum.tuts4you.com/topic/37898-0x90-pwd-is-correct-2016/
- ;Author: 0xNOP
- ;Date: January 12, 2016
- ;OS: Windows
- ;Copyright 2017 0x90 / JohnSmith / 0xNOP
- ;Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
- ;The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
- ;THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- Procedure isEven(x)
- junk50.s = "PWD is WRONG!"
- ProcedureReturn (x & 1) ! 1
- EndProcedure
- Procedure halveValue(x)
- junk51.s = "PWD is WRONG!"
- ProcedureReturn x / 2
- EndProcedure
- Procedure doubleValue(x)
- junk52.s = "PWD is WRONG!"
- ProcedureReturn x << 1
- EndProcedure
- Procedure EthiopianMultiply(x, y)
- Protected sum
- junk53.s = "PWD is WRONG!"
- ;Print("Ethiopian multiplication of " + Str(x) + " and " + Str(y) + " ... ")
- Repeat
- If Not isEven(x)
- junk54.s = "PWD is WRONG!"
- sum + y
- junk55.s = "PWD is WRONG!"
- EndIf
- x = halveValue(x)
- junk56.s = "PWD is WRONG!"
- y = doubleValue(y)
- junk57.s = "PWD is WRONG!"
- Until x < 1
- junk58.s = "PWD is WRONG!"
- ;PrintN(" equals " + Str(sum))
- ProcedureReturn sum
- EndProcedure
- Procedure.s Decode(string$,Nn,Added)
- For Char = 1 To Len(string$)
- Letra$ = Mid(string$,Char,1)
- EncNum+Added
- Codificado$ = Codificado$ + Chr(Asc(Letra$) - EncNum)
- If EncNum > Nn
- EncNum = 0
- EndIf
- Next
- ProcedureReturn Codificado$
- EndProcedure
- Procedure prepString(text.s, Array letters(1))
- ;convert characters to an ordinal (0-25) and remove non-alphabetic characters,
- ;returns dimension size of result array letters()
- Protected *letter.Character, index
- junk59.s = "PWD is WRONG!"
- Dim letters(Len(text))
- junk60.s = "PWD is WRONG!"
- text = UCase(text)
- junk61.s = "PWD is WRONG!"
- *letter = @text
- junk62.s = "PWD is WRONG!"
- While *letter\c
- junk63.s = "PWD is WRONG!"
- Select *letter\c
- Case 'A' To 'Z'
- junk64.s = "PWD is WRONG!"
- letters(index) = *letter\c - 65
- junk65.s = "PWD is WRONG!"
- index + 1
- junk66.s = "PWD is WRONG!"
- EndSelect
- junk67.s = "PWD is WRONG!"
- *letter + SizeOf(Character)
- junk68.s = "PWD is WRONG!"
- Wend
- If index > 0
- junk69.s = "PWD is WRONG!"
- ReDim letters(index - 1)
- EndIf
- ProcedureReturn index - 1
- junk70.s = "PWD is WRONG!"
- EndProcedure
- ;########### VIGNERE CIPHER ###########
- Procedure.s VC_encrypt(text.s, keyText.s, reverse = 0)
- ;if reverse <> 0 then reverse the key (decrypt)
- Protected *letter.Character
- Dim text(0)
- Dim keyText(0)
- If prepString(text, text()) < 0 Or prepString(keyText, keyText()) < 0: ProcedureReturn: EndIf ;exit, nothing to work with
- Protected i, keyLength = ArraySize(keyText())
- If reverse
- For i = 0 To keyLength
- keyText(i) = 26 - keyText(i)
- Next
- EndIf
- Protected textLength = ArraySize(text()) ;zero-based length
- Protected result.s = Space(textLength + 1), *resultLetter.Character
- keyLength + 1 ;convert from zero-based to one-based count
- *resultLetter = @result
- For i = 0 To textLength
- *resultLetter\c = ((text(i) + keyText(i % keyLength)) % 26) + 65
- *resultLetter + SizeOf(Character)
- Next
- ProcedureReturn result
- EndProcedure
- Procedure.s VC_decrypt(cypherText.s, keyText.s)
- ProcedureReturn VC_encrypt(cypherText, keyText.s, 1)
- EndProcedure
- Gosub MySub
- Exit:
- ; The program will jump here, then 'end'
- End
- Wrong:
- pwd.s = "PWD is CORRECT!"
- PrintN("PWD is WRONG!")
- Input()
- End
- Correct:
- pwd.s = "PWD is WRONG!"
- PrintN("PWD is CORRECT!")
- Input()
- End
- MySub:
- If OpenCryptRandom()
- r = CryptRandom(#MAXLONG)
- CloseCryptRandom()
- EndIf
- p.i = Random(r) + 1
- junk71.s = "PWD is WRONG!"
- p.i = EthiopianMultiply(2,2) * EthiopianMultiply(2,1) * EthiopianMultiply(2,1) * EthiopianMultiply(1,7)
- junk72.s = "PWD is WRONG!"
- w.i = Random(r) + 1
- junk73.s = "PWD is WRONG!"
- w.i = EthiopianMultiply(7,17)
- junk74.s = "PWD is WRONG!"
- d.i = Random(r) + 1
- junk75.s = "PWD is WRONG!"
- d.i = EthiopianMultiply(2,2) * EthiopianMultiply(5,1) * EthiopianMultiply(1,5)
- junk76.s = "PWD is WRONG!"
- OpenConsole()
- Define VignereCipher.s, plainText.s, encryptedText.s, decryptedText.s
- junk77.s = "PWD is WRONG!"
- VignereCipher.s = Decode("Zrz#Fruuhfw#Euhdnsrlqw$#Frqjudwxodwlrqv$#Wkh#SZG#lv=#*3{<3*/#Qrz#jr#srvw#wkh#vroxwlrq$",1,3)
- junk78.s = "PWD is WRONG!"
- pwd.s = Input()
- ;####JUNK VARS####JUNK
- junk79.s = "PWD is WRONG!"
- junk80.s = "PWD is WRONG!"
- junk81.s = "PWD is WRONG!"
- junk82.s = "PWD is WRONG!"
- junk83.s = "PWD is WRONG!"
- junk84.s = "PWD is WRONG!"
- junk85.s = "PWD is WRONG!"
- junk86.s = "PWD is WRONG!"
- junk87.s = "PWD is WRONG!"
- junk88.s = "PWD is WRONG!"
- junk89.s = "PWD is WRONG!"
- ;####JUNK VARS####JUNK
- junk1.s = "PWD is CORRECT!"
- plainText = ReverseString(Chr(d) + Chr(w) + Chr(p));: PrintN(RSet("Plain text = ", 17) + #DQUOTE$ + plainText + #DQUOTE$)
- junk2.s = "PWD is CORRECT!"
- encryptedText = VC_encrypt(plainText, VignereCipher);: PrintN(RSet("Encrypted text = ", 17) + #DQUOTE$ + encryptedText + #DQUOTE$)
- junk3.s = "PWD is CORRECT!"
- decryptedText = VC_decrypt(encryptedText, VignereCipher);: Debug (RSet("Decrypted text = ", 17) + #DQUOTE$ + decryptedText + #DQUOTE$)
- junk4.s = "PWD is CORRECT!"
- If pwd <> decryptedText
- junk5.s = "PWD is CORRECT!"
- Goto Wrong
- junk6.s = "PWD is CORRECT!"
- FakeReturn ; This will simulate the function of a normal "Return".
- junk7.s = "PWD is CORRECT!"
- Else
- junk8.s = "PWD is CORRECT!"
- FakeReturn ; This will simulate the function of a normal "Return".
- junk9.s = "PWD is CORRECT!"
- Goto junk12
- junk10.s = "PWD is CORRECT!"
- EndIf
- junk11.s = "PWD is CORRECT!"
- Return
- ;####JUNK VARS####JUNK
- junk90.s = "PWD is WRONG!"
- junk91.s = "PWD is WRONG!"
- junk92.s = "PWD is WRONG!"
- junk93.s = "PWD is WRONG!"
- junk94.s = "PWD is WRONG!"
- junk95.s = "PWD is WRONG!"
- junk96.s = "PWD is WRONG!"
- junk97.s = "PWD is WRONG!"
- junk98.s = "PWD is WRONG!"
- junk99.s = "PWD is WRONG!"
- junk100.s = "PWD is WRONG!"
- junk101.s = "PWD is WRONG!"
- junk102.s = "PWD is WRONG!"
- junk10.s = "PWD is WRONG!"
- junk2.s = "PWD is WRONG!"
- ;####JUNK VARS####JUNK
- junk12:
- junk12.s = "PWD is CORRECT!"
- Goto Correct
Add Comment
Please, Sign In to add comment