Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

startergo

macrumors 603
Sep 20, 2018
5,022
2,283
"base64 -D" works. "base64 -d" throws an error
Code:
hex=$(echo -n "A1QM4A==" | base64 -d | xxd -u -g 4 -e | sed -E 's/^.+: //;s/ .*//;')
g5@G5s-iMac-Pro ~ % echo 0x$hex
0xE00C5403
g5@G5s-iMac-Pro ~ % echo "obase=2;ibase=16;$hex"|bc
11100000000011000101010000000011
Code:
 hex=$(echo -n "A1QM4A==" | base64 -d | xxd -u -g 4 -e | sed -E 's/^.+: //;s/ .*//;') && echo 0x$hex && echo "obase=2;ibase=16;$hex"|bc
0xE00C5403
11100000000011000101010000000011
 

Dayo

macrumors 68020
Dec 21, 2018
2,257
1,279
Must be a bash/zsh thing:
Screen Shot 2020-11-30 at 19.09.09.jpg
 

startergo

macrumors 603
Sep 20, 2018
5,022
2,283
Must be a bash/zsh thing:
View attachment 1683390
Code:
echo -n "A1QM4A==" | base64 -d | xxd -u -g 4 -e | sed -E 's/^.+: //;s/ .*//;'                
E00C5403
Code:
man base64







     --break=count        Insert line breaks every count characters.  Default is 0, which generates an unbroken stream.

     -d
     -D
     --decode             Decode incoming Base64 stream into binary data.

     -h
     --help               Print usage summary and exit.

     -i input_file
     --input=input_file   Read input from input_file.  Default is stdin; passing - also represents stdin.

     -o output_file
     --output=output_file
                          Write output to output_file.  Default is stdout; passing - also represents stdout.

SEE ALSO
     openssl(1), wikipedia page:
           http://en.wikipedia.org/wiki/Base64,
     RFC 4648:
           http://tools.ietf.org/html/rfc4648

Mac OS X 10.7                  February 8, 2011                  Mac OS X 10.7
 

Dayo

macrumors 68020
Dec 21, 2018
2,257
1,279
You are clearly not running bash.
Presume you are on Catalina which uses zsh. Hence the "bash/zsh" mention.

On additional Item posted, not sure what the point being made is but whatever the case, can't argue with error message I got. Now, time to move on?
 
Last edited:
  • Like
Reactions: startergo

startergo

macrumors 603
Sep 20, 2018
5,022
2,283
You are clearly not running bash.
Presume you are on Catalina which uses zsh. Hence the "bash/zsh" mention.

On additional Item posted, not sure what the point being made is but whatever the case, can't argue with error message I got. Now, time to move on?
Not sure what is different I tried bash too. I run Big Sur. Anyhow let's move on.
 
  • Like
Reactions: Dayo

TECK

macrumors 65816
Original poster
Nov 18, 2011
1,129
478
Code:
hex=$(echo -n "A1QM4A==" | base64 -d | xxd -u -g 4 -e | sed -E 's/^.+: //;s/ .*//;')
g5@G5s-iMac-Pro ~ % echo 0x$hex
0xE00C5403
g5@G5s-iMac-Pro ~ % echo "obase=2;ibase=16;$hex"|bc
11100000000011000101010000000011
Code:
 hex=$(echo -n "A1QM4A==" | base64 -d | xxd -u -g 4 -e | sed -E 's/^.+: //;s/ .*//;') && echo 0x$hex && echo "obase=2;ibase=16;$hex"|bc
0xE00C5403
11100000000011000101010000000011
I use Hackintool, might be easier:

1606779411609.png


I actually made a Python unhexlify method to convert Hex 00 00 00 00 00 00 00 00 00 00 10 00 00 00 00 00 into base64 Data AAAAAAAAAAAAABAAAAAAAA==
 

startergo

macrumors 603
Sep 20, 2018
5,022
2,283
I use Hackintool, might be easier:

View attachment 1683857

I actually made a Python unhexlify method to convert Hex 00 00 00 00 00 00 00 00 00 00 10 00 00 00 00 00 into base64 Data AAAAAAAAAAAAABAAAAAAAA==
The important thing here is the binary conversion. The Hackintool conversion is certainly not faster then the single-liner above.
 

TECK

macrumors 65816
Original poster
Nov 18, 2011
1,129
478
I think the safest way is always use Hex transformation, regardless the tool. :) I personally like Hackintool because I just paste the Hex value directly into the Python unhexlify method and I don't have to fiddle with escaped chars or anything else.

I'll give you the perfect example, you need to escape the ASCII string with \0, which is a null terminator used to end the string, for safety reasons. Otherwise your Base64 is wrong, that is why I prefer always Hex values to be passed.

1606785108207.png
 

startergo

macrumors 603
Sep 20, 2018
5,022
2,283
  • Like
Reactions: TECK

Dayo

macrumors 68020
Dec 21, 2018
2,257
1,279
not sure how the FirmwareFeaturesMask is calculated. Any idea?
Actually, FirmwareFeaturesMask of 0xFF1FFF3F is the default for cMP5,1 in the OpenCore Apple Database: AppleModels/DataBase/MacPro/MP51.yaml

The actual FirmwareFeatures value in the DB is 0xE80FE137 which is being amended to 0xE00C5403 by the suggestion in the OC Thread. Seems to be removing bits from what's in the cMP5,1 DB but I haven't looked into these bits. Hoping @cdf can shed some light later.

FirmwareFeaturesComp51.gif
 
Last edited:
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.