Back
Close

Base4 encryption

Statement

 Goal

You have just created your website. For security reasons, you decide to encrypt your users's passwords, and create your own encryption algorithm: base4 encryption.

Base4 is a group of similar binary-to-text encoding schemes that represent binary data in an ASCII string format by translating it into a radix-4 representation.
Input
Line 1: An integer N for the number of passwords
Next N lines: The passwords to encrypt
Output
N lines: The encrypted passwords
Constraints
1 ≤ N ≤ 100
passwords length ≤ 16
passwords are valid ASCII strings
Example
Input
1
abc
Output
120112021203

Game modes
Fastest, Shortest, Reverse

Test cases
Simple Test
Input
1 abc
Output
120112021203

Validator 1 Validator
Input
1 bdi
Output
120212101221

Leading zeros Test
Input
1 *
Output
0222

Validator 2 Validator
Input
1 (wow)
Output
02201313123313130221

Strong Test
Input
3 N'cQY5y$;96eAtJT *T.=V4q''?my*Vq[ AtuAzUT-&TT/z9~Z
Output
1032021312031101112103111321021003230321031212111001131010221110 0222111002320331111203101301021302130333123113210222111213011123 1001131013111001132211111110023102121110111002331322032113321122

Validator 3 Validator
Input
3 &_g{K$Kp59yW+XeR p^u*R8)'y#HC=SpV MwLb<5#g)/Ap4:;k
Output
0212113312131323102302101023130003110321132111130223112012111102 1300113213110222110203200221021313210203102010030331110313001112 1031131310301202033003110203121302210233100113000310032203231223

Weak Test
Input
5 123456 password 12345678 qwerty 12345
Output
030103020303031003110312 13001201130313031313123313021210 03010302030303100311031203130320 130113131211130213101321 03010302030303100311

Validator 4 Validator
Input
5 123456789 letmein 1234567 football iloveyou
Output
030103020303031003110312031303200321 1230121113101231121112211232 0301030203030310031103120313 12121233123313101202120112301230 12211230123313121211132112331311

Solution language

Solution

Stub generator input