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
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.
2
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
1
Last Post!
massimo
base64decode.org is simply removing the non printable characters.
try on this one and see the difference https://codebeautify.org/base64-decode
0
Popular in Questions
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
I would like to know what is the best IDE for elixir development?
New
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
Why is it that the mnesia database isn’t the most preferred database for use in Elixir/Phoenix?
New
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
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
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
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
Hi folks,
Few months ago I have announced the proof-of-concept of the library to manipulate the browsers DOM objects directly from Elixi...
New
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
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
Surface is an experimental library built on top of Phoenix LiveView and its new LiveComponent API that aims to provide a more declarative...
New
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
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #elixirconf-us
- #advent-of-code
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #hex
- #security









