# Algorithm

Encrypting

1. Perform left circular shift the specified byte array every 8 bits. (num of shift: 0-7)
* Perform bit-invertion in case of the shifting position is 0.
2. Encode the bit-rotated byte array into a newly-allocated byte array using the Base64 encoding scheme.

Decrypting

Manipulate in the opposite way.

# Examples

Normal Base64

Source Text(ASCII) abc
Source octets 97 (0x61)98 (0x62)99 (0x63)
Bit pattern 01100001 01100010 01100011
Index 2422935
Base64-encoded YWJj
Encoded octets 89 (0x59)87 (0x57)74 (0x4A)106 (0x6A)

BSB64 (n = 1)

Source Text(ASCII) abc
Source octets 97 (0x61)98 (0x62)99 (0x63)
Bit pattern 01100001 01100010 01100011
Bit rotation 11000010 11000100 11000110
Index 4844196
Base64-encoded wsTG
Encoded octets 119 (0x77)115 (0x73)84 (0x54)71 (0x47)

BSB64 (n = 0)

Source Text(ASCII) abc
Source octets 97 (0x61)98 (0x62)99 (0x63)
Bit pattern 01100001 01100010 01100011
Bit invertion 10011110 10011101 10011100
Index39415428
Base64-encodednp2c
Encoded octets 110 (0x6E)112 (0x70)50 (0x32)99 (0x63)

# Implementation

Java, JavaScript, Python, VBA implementations are available on GitHub.

Apache Maven

Maven Central
https://search.maven.org/artifact/com.bsb64/bsb64/1.0.0/jar

JAR direct download
bsb64-1.0.0.jar (3,827 bytes / Compiled with JDK8)
SHA256: 4879ddf7e434e622e0c31bd8d72eb0b822dd4acc067fabf0a5648f69d785120f

# Notice

BSB64 is not intended to be used where secrecy is of any concern.
x
The Base 64 Alphabet Value Encoding Value Encoding Value Encoding Value Encoding 0 A 17 R 34 i 51 z 1 B 18 S 35 j 52 0 2 C 19 T 36 k 53 1 3 D 20 U 37 l 54 2 4 E 21 V 38 m 55 3 5 F 22 W 39 n 56 4 6 G 23 X 40 o 57 5 7 H 24 Y 41 p 58 6 8 I 25 Z 42 q 59 7 9 J 26 a 43 r 60 8 10 K 27 b 44 s 61 9 11 L 28 c 45 t 62 + 12 M 29 d 46 u 63 / 13 N 30 e 47 v 14 O 31 f 48 w (pad) = 15 P 32 g 49 x 16 Q 33 h 50 y