Skip to content

Instantly share code, notes, and snippets.

@tyage tyage/raddit.php

Last active Apr 1, 2020
Embed
What would you like to do?
<?php
$encrypted_block = 'PKklQOstCkI=';
$message = '';
$charset = '_-abcdefghijklmnopqrstuvwxyz0123456789';
$str_length = strlen($charset);
$method = 'DES-ECB';
function check($flag) {
global $message, $method, $encrypted_block;
$crypto = openssl_encrypt($message, $method, $flag);
if ($crypto == $encrypted_block) {
echo $flag;
exit;
}
}
function recurse($width, $position, $base_string) {
global $charset, $str_length;
for ($i = 0; $i < $str_length; ++$i) {
if ($position < $width - 1) {
recurse($width, $position + 1, $base_string . $charset[$i]);
}
check($base_string . $charset[$i]);
}
}
for ($i = 1; $i < 8 + 1; ++$i) {
echo "start $i";
recurse($i, 0, '');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.