Skip to content

Instantly share code, notes, and snippets.

View e-ravanbakhsh12's full-sized avatar

ehsan ravanbakhsh e-ravanbakhsh12

View GitHub Profile
@etienne-martin
etienne-martin / crypto-js.php
Created November 7, 2019 15:06
Decrypt a crypto-js encrypted string with php
function evpKDF($password, $salt, $keySize = 8, $ivSize = 4, $iterations = 1, $hashAlgorithm = "md5") {
$targetKeySize = $keySize + $ivSize;
$derivedBytes = "";
$numberOfDerivedWords = 0;
$block = NULL;
$hasher = hash_init($hashAlgorithm);
while ($numberOfDerivedWords < $targetKeySize) {
if ($block != NULL) {
hash_update($hasher, $block);
}