Tag Archives: Base64

How to Encode / Decode to / from base64 in Node.JS

Today I ran into this basic problem. A quick search on google gave me the answer, I tested it, it worked, and the rest is history. Here is the code. let plainText = “Hello World!”; console.log(“Plaint text = ” + plainText); // Encoding to base64 let base64 = new Buffer(plainText).toString(‘base64’); console.log(“Encoded to base64 = ” […]

How to generate RSA key pair in Java 1.8

Recently I was wondering how to generate a private key in Java for a personal project. I found out how to generate the actual key pair with RSA algorithm. Here is the java code for that, a simple class that you can run to check how things work. import java.security.KeyPairGenerator; import java.security.KeyPair; import java.security.PrivateKey; import […]