How to get base64 encoding the same for AutoIt and PowerShell?

Question:

I use Ward’s AutoIt Machine Code Algorithm Collection to get base64 encoding of a string in AutoIt:

The result:

PowerShell code to get the base64 encoding of the same string “ps”:

What I got is:

The result from PowerShell is what I want. How to get the same result using AutoIt? I guess this is a character encoding issue.

Answer:

When I ran this script:

I get the result: 0x70007300. Basically, this means there is a ’70’ character (p), a ’00’ character (nul), a ’73’ character (s), ’00’ character. You can easily recreate this behavior in AutoIt with a function like this:

The result is: cABzAA==

Somewhat hack-ish, but I’d say it is preferred over full Unicode encoding if that’s not what you will ever need.

Source:

How to get base64 encoding the same for AutoIt and PowerShell? by licensed under CC BY-SA | With most appropriate answer!

Leave a Reply