Jump to content

DllCall/Open (Blowfish Encryption .dll)


Recommended Posts

sup everyone... ok so i found this site . . .


and i'm trying to do that sample encryption in AutoIt, but i'm not getting the same results . . .

$dll = DllOpen("diCryptoSys.dll")


    $strInput = "0123456789ABCDEF"
    $strKey = "FEDCBA9876543210"
    $sCorrect = "0ACEAB0FC6A0A28D"
    ; Set strOutput to be same length as strInput
    $strOutput = String(StringLen($strInput))

    ConsoleWrite("KY= " & $strKey & @CR)
    ConsoleWrite("PT= " & $strInput & @CR)
    ; Encrypt in one-off process
    $nRet = DllCall($dll, "long", "BLF_Hex", "String", $strOutput, "String", $strInput, "String", $strKey, "Boolean", True)
    ConsoleWrite("CT= " & $strOutput & @CR)
    ConsoleWrite("OK= " & $sCorrect & @CR)

    ; Now decrypt back to plain text
    $strInput = $strOutput
    $nRet = DllCall($dll, "long", "BLF_Hex", "String", $strOutput, "String", $strInput, "String", $strKey, "Boo", False)
    ConsoleWrite("P'= " & $strOutput & @CR)

the results i get are...

KY= FEDCBA9876543210

PT= 0123456789ABCDEF

CT= 16


P'= 16

i'm not sure what the problem is... i put the diCryptoSys.dll in the same folder . . . Edited by SomeoneHere
Link to comment
Share on other sites

If i'm not mistaken, DllOpen("diCryptoSys.dll") refers to "C:\Windows\System32\diCryptoSys.dll". Try putting in the full path of the dll (@ScriptDir & "\diCryptoSys.dll").

the problem isn't that it doesn't find the DLL (i checked it returns a value of 1)... it's somethine else which i don't know

Link to comment
Share on other sites

yes, it was my attempt at converting VB6 to AutoIt... which i "think" there's no errors in, or at least can't find it? :D

Try this:

$hDLL = DllOpen("diCryptoSys.dll")

$sInput = "0123456789ABCDEF"
$sKey = "FEDCBA9876543210"
$sCorrect = "0ACEAB0FC6A0A28D"

ConsoleWrite("KY= " & $sKey & @CRLF)
ConsoleWrite("PT= " & $sInput & @CRLF)

$aCall = DllCall($hDLL, "int", "BLF_Hex", "str", "", "str", $sInput, "str", $sKey, "int", 1)
; ...check for errors here...

$sOutput = $aCall[1]

ConsoleWrite("CT= " & $sOutput & @CRLF)
ConsoleWrite("OK= " & $sCorrect & @CRLF)

$sInput = $sOutput

$aCall = DllCall($hDLL, "int", "BLF_Hex", "str", "", "str", $sInput, "str", $sKey, "int", 0)
; ...check for errors here...

ConsoleWrite("P'= " & $aCall[1] & @CRLF)
Edited by trancexx




Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...