hash and decrypt base64 string javascript code example

Example 1: javascript base64 encode

var string = "Hello folks how are you doing today?";
var encodedString = btoa(string); // Base64 encode the String
var decodedString = atob(encodedString); // Base64 decode the String

Example 2: java base64 decrypt script

import java.util.Base64;

class Base64Decode {
  public static void main(String[] args) {
    String b64 = "Z3VydQ==";
    byte[] decoder = Base64.getDecoder().decode(b64);
    String str = new String(decoder);
    System.out.println(str); //-> "guru"
  }
}

Tags:

Java Example