php
Generate rand hash by md5 and sha1
i have used md5(sha1(rand())) this will give me 2 levels of encryption and output hash with 32 length like cbc7a20f14eab9262efe0adb21074d0a but how i can let hash be 255 length (for example) ?
Whatever you're doing just stop it now. Calling the same or different cryptographic functions repeatedly does not do anything like give you multiple levels of encryption. If anything, it weakens the encryption by making it easier to find a hash collision. Moreover, neither md5 nor sha-1 are cryptographically secure. If you're trying to create passwords, use bcrypt or PBKDF2 (and only once). Don't forget to use a unique salt and high iteration count. You may use a KBKDF (key based key derivation function) like the ones specified in NIST SP 800-108 or HKDF to expand the output of bcrypt or PBKDF2 into more bytes. Note however that this does not increase the security level to the number of bytes in the output.
If you want to create cryptographic random numbers, anything relying on rand() won't do any good. No matter which hash or KDF you throw at it. Use mcrypt_create_iv ($size, MCRYPT_DEV_URANDOM) instead, which conventiently has a $size parameter, solving your length problem at the same time.
Related Links
How can I collect all my types into one table in laravel?
PHP Toggle switch with update database
Doctrine ORM, ManyToMany - duplicates on lazy fetch
Save select value onchange Laravel
Symfony Assetic Dump get class not Found Exception
Use Interface as __constructor() parameter
High TTFB after moving WordPress multisite from Windows to Linux
“OnClick” Ajax function on ''IMAP to PHP page''
Should/Must I use PDO::PARAM_NULL when binding a value that is null?
which data types- foreach
csrf_exempt decorator not exempting
Phpunit: how to assert that a file is an image? [duplicate]
Deploying a Vue.js app on DigitalOcean
PDO select all function [duplicate]
Sanitize custom checkout fields data in WooCommerce
Create validation rule which can stop other checks in laravel 5.3