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

lanycrost
Hi everyone! I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New
openscript
Hello! Sorry for this astonishing simple question, but I’m really stuck. I try to set up the intellij-elixir plugin, but I don’t know ho...
New
PeterCarter
There are pre-rolled solutions for other frameworks that do work. However, Phoenix does not seem to have these. Have people had good expe...
New
Lily
In templates/appointment/index.html.eex: &lt;%= for appointment &lt;- @appointments do %&gt; &lt;tr&gt; &lt;td&gt;&lt;%= appoi...
New
nsuchy
Hi. I’ve noticed that Windows Powershell has it’s own IEX command and you cannot access Elixir’s IEX due to the conflict. This isn’t a cr...
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
fayddelight
I tried installing elixir 1.11.2 erlang 23.3.4 via asdf in my zsh shell. Enabled the versions locally and globally. When I list them ...
New

Other popular topics Top

JeremM34
Hello, how can I check the Phoenix version ? Thanks !
New
vonH
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
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
chrismccord
Phoenix 1.4.0 released Phoenix 1.4 is out! This release ships with exciting new features, most notably with HTTP2 support, improved deve...
688 31525 112
New
shijith.k
I am trying to start a new phoenix project with elixir 1.9, but mix phx.new does not work. It says that ** (Mix) The task "phx.new" could...
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

We're in Beta

About us Mission Statement