I am looking for a base32 function/class for php. the different classes and function that i found are all very ineffective. I ran a benchmark and came to the following resul
Try this: https://github.com/bbars/utils/blob/master/php-base32-encode-decode/Base32.php
Uses case-insesitive alpabet [0-9, a-v]
and works faster than Base2n(5)
:
size | Base32::encode | Base32::decode | $base2n->encode | $base2n->decode
-------------------------------------------------------------------------------
1 | 0.0000331401825 | 0.0000088214874 | 0.0002369880676 | 0.0001671314240
2 | 0.0000050067902 | 0.0000040531158 | 0.0000100135803 | 0.0000081062317
4 | 0.0000050067902 | 0.0000059604645 | 0.0000097751617 | 0.0000100135803
8 | 0.0000078678131 | 0.0000100135803 | 0.0000131130219 | 0.0000140666962
16 | 0.0000128746033 | 0.0000178813934 | 0.0000250339508 | 0.0000250339508
32 | 0.0000238418579 | 0.0000319480896 | 0.0000441074371 | 0.0000472068787
64 | 0.0001170635223 | 0.0000629425049 | 0.0000870227814 | 0.0000259876251
128 | 0.0000879764557 | 0.0001208782196 | 0.0001959800720 | 0.0001759529114
256 | 0.0001969337463 | 0.0002408027649 | 0.0004429817200 | 0.0003459453583
512 | 0.0003631114960 | 0.0004880428314 | 0.0021460056305 | 0.0006039142609
1024 | 0.0014970302582 | 0.0009729862213 | 0.0108621120453 | 0.0015850067139
2048 | 0.0013530254364 | 0.0018491744995 | 0.0312080383301 | 0.0027630329132
4096 | 0.0027470588684 | 0.0038080215454 | 0.1312029361725 | 0.0064430236816
8192 | 0.0064270496368 | 0.0086290836334 | 0.5233020782471 | 0.0121779441833
16384 | 0.0112588405609 | 0.0167109966278 | 2.0316259860992 | 0.0277659893036
32768 | 0.0235319137573 | 0.0335960388184 | 11.6220989227295 | 0.0498571395874
65536 | 0.0478749275208 | 0.0648550987244 | |
131072 | 0.1030550003052 | 0.1504058837891 | |
262144 | 0.1995100975037 | 0.2654621601105 | |
524288 | 0.3903131484985 | 0.5326008796692 | |