Category : sha1

I need to count hits (array items from url parsed page) <?php ini_set("display_errors", "1"); error_reporting(E_ALL); if(isset($_POST[‘userinput’])) { $output=""; $data=$_POST["userinput"]; $hashed=strtoupper(sha1($data)); $chars=substr($hashed, 0, 5); $url="https://api.pwnedpasswords.com/range/$chars"; $test=file($url); $lines_array=array($test); $hits_array=explode(" ","$test"); $hits=count("$hits_array"); // determin hits if($hits > 0){ $output="<center>This Password Has Been Found $hits Times,<br><b>So Do NOT Use This Password!!!</b>"; } else { $output="<center> Password Seems To Be ..

Read more

I’m trying to insert my signup data into the MySQL database but I’m getting the error(Incorrect parameter count in the call to native function ‘SHA1’) $query = $dbconn->query("INSERT INTO userinfo(Fname, Lname, Email, Password, Vkeys) VALUES (‘{$Fname}’, ‘{$Lname}’, ‘{$email}’, SHA1(‘{$pass}’, ‘{$keys}’))"); Sourc..

Read more

we have existing user base on mysql with password encoded using md5 and sha1, with below logic – // Password and salt generation define(‘SALT_LENGTH’, 9); // salt for password function PwdHash($pwd, $salt = null) { if ($salt === null) { $salt = substr(md5(uniqid(rand(), true)), 0, SALT_LENGTH); } else { $salt = substr($salt, 0, SALT_LENGTH); } ..

Read more

I have written this code below. <?php $str = "hafeezullah"; echo "TRUE – Raw 20 character binary format: ".sha1($str, TRUE)."<br>"; ?> I read the tutorials that if in the sha1 method TRUE(parameter) is passed then it generates 20 binary characters, but when I practically implemented it then it generated only 2 binary characters. What is ..

Read more

I’m trying to dynamically generate a security header at Postman pre-request script. To do so, I need to transform the following code snippet from PHP to JS. $password = "SECRETPASSWORD"; $nonce = random_bytes(32); date_default_timezone_set("UTC"); $created = date(DATE_ATOM); $encodedNonce = base64_encode($nonce); $passwordHash = base64_encode(sha1($nonce . $created . sha1($password, true), true)); (Note the true flag at php’s ..

Read more