All Products
Search
Document Center

Blockchain as a Service:Base64 Encoding and Decoding Library

Last Updated:May 22, 2019

Function example

Base64 is a group of encoding schemes used to encode the checksum. The example is as follows:

  1. function test_base64_decode() returns (bool , string memory)
  2. {
  3. string memory name = "aHR0cDovL3Rlc3RfYmFzZTY0IH4hQCMkJQ==";
  4. return base64_decode(name);
  5. }
  6. function test_base64_encode() returns (bool , string memory)
  7. {
  8. string memory name = "http://test_base64 ~! @#$%";
  9. return base64_encode(name);
  10. }

base64_decode

The base64_decode() function is an inbuilt function in PHP used to decode data which is encoded in MIME base64.

Function

  1. base64_decode(string data) returns(bool result, string memory data);

Request parameters

Name Required Type Description
data Yes string The data to be decoded.

Response parameters

Parameter Required Type Description
result Yes bool The return value of the method. A value of true indicates that the method is called. A value of false indicates that the call has failed.
data Yes string The encoded data that is returned.

base64_encode

The base64_encode() function is an inbuilt function in PHP used to encode data with MIME base64.

Function

  1. base64_encode(string data) returns(bool result, string memory data) ;

Request parameters

Name Required Type Description
data Yes string The data to be encoded.

Response parameters

Parameter Required Type Description
result Yes bool The return value of the method. A value of true indicates that the method is called. A value of false indicates that the call has failed.
data Yes string The encoded data that is returned.