C. Ubkcah
C. Ubkcah

Reputation: 273

Decode Base64 string

I am currently working on a custom SAPUI5 app. I would like to make a service call, which expects the Guid in a different format than it is currently available.

An example:

I have not found an online decoder, which could produce the desired result, however, I was able to encode the guid 42F2C0514CD40996E10000008D24B to QvLAUUzUCZbhAAAAjss2iA== with the SAP ABAP standard function module HTTP_BASE64_ENCODE. With the usual online encoders, however, I got a different result.

How can I decode the encoded guid with JavaScript so that it has the desired format?

Upvotes: 3

Views: 2459

Answers (1)

filipe
filipe

Reputation: 2047

The string is in hexadecimal format you will have to convert it.

First you convert the string to binary (atob > charCodeAt) and then using the toString(16) you get the hex.

I will not post the code, since its already explained Decode Base64 to Hexadecimal string with javascript

Upvotes: 1

Related Questions