jeramyRR

jeramyRR

Problems properly decoding a base64 encoded string

I am trying to decode an Azure Storage Key that’s supposedly base64 encoded, but I’m getting all kinds of wonkey characters. Example:

Base.decode64! "ZG2p8/z2ATu8NVLBXmeFtkX9chpkbk2EK9fH4qVKxvC//mSlIdsqzvZpNa4k7tPPR86RmiGkdi0BLwAEtPbkXA==" |> String.codepoints

Results in:

[
  "d",
  "m",
  <<169>>,
  <<243>>,
  <<252>>,
  <<246>>,
  <<1>>,
  ";",
  <<188>>,
  "5",
  "R",
  <<193>>,
  "^",
  "g",
  <<133>>,
  <<182>>,
  "E",
  <<253>>,
  "r",
  <<26>>,
  "d",
  "n",
  "M",
  <<132>>,
  "+",
  <<215>>,
  <<199>>,
  <<226>>,
  <<165>>,
  "J",
  <<198>>,
  <<240>>,
  <<191>>,
  <<254>>,
  "d",
  <<165>>,
  "!",
  <<219>>,
  "*",
  <<206>>,
  <<246>>,
  "i",
  "5",
  <<174>>,
  "$",
  <<238>>,
  <<211>>,
  <<207>>,
  "G",
  "Α",
  ...
]

This definitely isn’t correct, or I’m not thinking about something correctly here. Is there something I need to do special for utf8 encoded strings?

Thanks for the help,
Jeramy

Most Liked

jeramyRR

jeramyRR

We can close this thread. I got it figured out. There was nothing wrong with the key. There was however a mistake in my spelling.

massimo

massimo

It’s correct

the decoded string contains those characters

echo "ZG2p8/z2ATu8NVLBXmeFtkX9chpkbk2EK9fH4qVKxvC//mSlIdsqzvZpNa4k7tPPR86RmiGkdi0BLwAEtPbkXA==" | base64 -D -i - | hexdump -c
0000000   d   m   �   �   �   � 001   ;   �   5   R   �   ^   g 205   �
0000010   E   �   r 032   d   n   M 204   +   �   �   �   �   J   �   �
0000020   �   �   d   �   !   �   *   �   �   i   5   �   $   �   �   �
0000030   G   � 221 232   !   �   v   - 001   /  \0 004   �   �   �   \
0000040

Last Post!

massimo

massimo

base64decode.org is simply removing the non printable characters.
try on this one and see the difference https://codebeautify.org/base64-decode

Where Next?

Popular in Questions Top

joaquinalcerro
Hi there, I am working with Ecto-Postgresql and I need to call all of the records from a specific table but the table has 40,000 records...
New
hariharasudhan94
I would like to know what is the best IDE for elixir development?
New
Brian
What is the proper way to load a module from a file in to IEX? In the python world, doing something like this pretty standard: from ....
New
jay1
Why is it that the mnesia database isn’t the most preferred database for use in Elixir/Phoenix?
New
jerry
Good day to you all. I have been struggling to get a query involving like and ilike to work. Can anyone assist me on this, please? pro...
New
alice
Hey, Just curious what are the main benefits of Elixir compared to Clojure? When is Elixir more useful than Clojure and vice versa? Th...
New
freewebwithme
Using vs code and installed ElixirLS: support and debugger. And I got an error popped up on start up says Failed to run ‘elixir’ comma...
New

Other popular topics Top

electic
Hi, I am new to Elixir. I am trying to use the DateTime component to insert a date into MySQL however the there seems to be no way to fo...
New
grych
Hi folks, Few months ago I have announced the proof-of-concept of the library to manipulate the browsers DOM objects directly from Elixi...
639 54006 488
New
stefanchrobot
What’s the safe way to decode a JSON string into a struct? I want to avoid calling String.to_atom. Jason.decode can give me a map with st...
New
Darmani72
If I have a post route which an argument: post /my_post_route/:my_param1, MyController.my_post_handler How would get the post params ...
New
msaraiva
Surface is an experimental library built on top of Phoenix LiveView and its new LiveComponent API that aims to provide a more declarative...
564 44139 214
New
dblack
I’ve got an issue with an app and I’ve no idea of how to troubleshoot it. I’m hoping someone here might have seen something similar. I p...
New

We're in Beta

About us Mission Statement