From 3728f03af34301a16a5f4f452caac10f48099628 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Sun, 1 Jan 2017 12:31:24 +0000 Subject: [PATCH] Added file id permutator --- id.php | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 id.php diff --git a/id.php b/id.php new file mode 100644 index 00000000..317414d5 --- /dev/null +++ b/id.php @@ -0,0 +1,36 @@ +. +*/ + +require 'vendor/autoload.php'; + +$id = "AgADBAADcKoxG4_aCgYKET2oLMua7pxRaRkABKoeLWY9bpazGdcCAAEC"; + +function foreach_offset_length($string, $callback) { + $strlen = strlen($string); + for ($offset = 0; $offset < strlen($string); $offset++) { + for ($length = $strlen - $offset; $length > 0; $length--) { + $s = substr($string, $offset, $length); + echo 'Offset: '.$offset.', length: '.$length.', res: '; + $callback($s); + } + } +} + +$base256 = base64url_decode($id); +foreach_offset_length($base256, function ($s) { + $int = (string)(new \phpseclib\Math\BigInteger(strrev($s), 256)); + echo $int.PHP_EOL; +}); + +function base64url_decode($data) { + return base64_decode(str_pad(strtr($data, '-_', '+/'), strlen($data) % 4, '=', STR_PAD_RIGHT)); +}