Tutorial on Encoding binary data to a string with Maestrith

In the second half of our webinar on Finding and Clicking Text / Pixels / Images someone asked about encoding a binary image to Base64, then being able to decode it back for usage (this will allow them not to have to share the actual image files.)

I’ve never done any of this so I was lost but thankfully Jackie and Maestrith had experience in it.   The other night I mentioned it to Maestrith and he generously offered to work through a couple of examples and explain the process to me.

Please keep in mind, this wasn’t a planned tutorial.  He did it on the fly and we just worked through things.  For me it was very illuminating!

Encoding binary data to a string Tutorial

 

Encoding binary data to a string source code: 

Bits:="100011010010010101011001010"
Bits:="Hq"
/*
  0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz

  5
  100
  0=0
  1=1
  2=10
  3=11
  4=100
  5=110
  6=111
  7=1000
*/
Gui,Add,Edit,gGo w500 Number
Gui,Add,UpDown,Range1-5000 +0x80,1
Gui,Add,Text,w500
Gui,Show
return
GuiEscape:
ExitApp
return
Go(){
  ControlGetText,i,Edit1,A
  ControlSetText,Static1,% ((i>>8&1)(i>>7&1)(i>>6&1)(i>>5&1)(i>>4&1)(i>>3&1)(i>>2&1)(i>>1&1)(i&1)),A
}

 

 

Comments are closed.