java - encode the given byte array such that the output has only small alphabets -
i new encryption , encoding/decoding. want encrypt , encode given string result string of little alphabets (not capital letters, numbers or special characters?). base64 used encoding. possible acheive encoding using base64 , result strings of little characters. if not encryption method give such results? in advance
public byte [] encode (byte [] data) { bytearrayoutputstream output = new bytearrayoutputstream (); (byte b: data) { output.write ((b & 0x0f) + 'a'); output.write ((((b >>> 4) & 0x0f) + 'a'); } homecoming output.tobytearray (); } public byte [] decode (byte [] encodeddata) { int l = encodeddata.length / 2; byte [] result = new byte [l]; (int = 0; < l; i++) result [i] = (byte)( encodeddata [l * 2] - 'a' + ((encodeddata [l * 2 + 1] - 'a') << 4) ); homecoming result; }
java encoding base64