Warriors.to Underground Forum - Hack Forum - Leak Forum
  • Home
  • Forums
    New posts Search forums
  • Resources
    Latest reviews Search resources
  • Members
    Current visitors New profile posts Search profile posts
  • Awards
  • Chat 0
Log in Register
What's new Search

Search

By:
Advanced search…
Warriors.to Underground Forum - Hack Forum - Leak Forum
    • Home
    • Forums
    • Software
    • PHP/JS/MySQL/Perl
  • Home
  • Forums
  • Software
  • PHP/JS/MySQL/Perl
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an alternative browser.

PHP crypt() Function

  • Thread starter Lexter
  • Start date Dec 2, 2022
L

Lexter

Member
Messages
27
Joined
Nov 30, 2022
Reaction score
21
Points
3
wCoin
508
  • Dec 2, 2022
  • #1

Definition and Usage​


The crypt() function returns a hashed string using DES, Blowfish, or MD5 algorithms.


This function behaves different on different operating systems. PHP checks what algorithms are available and what algorithms to use when it is installed.


The salt parameter is optional. However, crypt() creates a weak password without the salt. Make sure to specify a strong enough salt for better security.


There are some constants that are used together with the crypt() function. The value of these constants are set by PHP when it is installed.


Constants:


  • [CRYPT_STD_DES] - Standard DES-based hash with two character salt from the alphabet "./0-9A-Za-z". Using invalid characters in the salt will cause this function to fail.
  • [CRYPT_EXT_DES] - Extended DES-based hash with a nine character salt consisting of an underscore followed by 4 bytes of iteration count and 4 bytes of salt. These are encoded as printable characters, 6 bits per character, least significant character first. The values 0 to 63 are encoded as "./0-9A-Za-z". Using invalid characters in the salt will cause the function to fail.
  • [CRYPT_MD5] - MD5 hashing with a 12 character salt starting with $1$
  • [CRYPT_BLOWFISH] - Blowfish hashing with a salt starting with $2a$, $2x$, or $2y$, a two digit cost parameters "$", and 22 characters from the alphabet "./0-9A-Za-z". Using characters outside of the alphabet will cause this function to return a zero-length string. The "$" parameter is the base-2 logarithm of the iteration count for the underlying Blowfish-bashed hashing algorithmeter and must be in range 04-31. Values outside this range will cause the function to fail.
  • [CRYPT_SHA_256] - SHA-256 hash with a 16 character salt starting with $5$. If the salt string starts with "rounds=<N>$", the numeric value of N is used to indicate how many times the hashing loop should be executed, much like the cost parameter on Blowfish. The default number of rounds is 5000, there is a minimum of 1000 and a maximum of 999,999,999. Any selection of N outside this range will be truncated to the nearest limit.
  • [CRYPT_SHA_512] - SHA-512 hash with a 16 character salt starting with $6$. If the salt string starts with "rounds=<N>$", the numeric value of N is used to indicate how many times the hashing loop should be executed, much like the cost parameter on Blowfish. The default number of rounds is 5000, there is a minimum of 1000 and a maximum of 999,999,999. Any selection of N outside this range will be truncated to the nearest limit.

On systems where this function supports multiple algorithms, the constants above are set to "1" if supported and "0" otherwise.


Note: There is no decrypt function. The crypt() function uses a one-way algorithm.




Syntax​

Please, Log in or Register to view quote content!
Click to expand...

Example​


In this example we will test the different algorithms:


PHP:
Please, Log in or Register to view codes content!

The output of the code above could be (depending on the operating system):


Standard DES: stqAdD7zlbByI
Extended DES: _S4..someQXidlBpTUu6
MD5: $1$somethin$4NZKrUlY6r7K7.rdEOZ0w.
Blowfish: $2a$09$anexamplestringforsaleLouKejcjRlExmf1671qw3Khl49R3dfu
SHA-256: $5$rounds=5000$anexamplestringf$KIrctqsxo2wrPg5Ag/hs4jTi4PmoNKQUGWFXlVy9vu9
SHA-512: $6$rounds=5000$anexamplestringf$Oo0skOAdUFXkQxJpwzO05wgRHG0dhuaPBaOU/
oNbGpCEKlf/7oVM5wn6AN0w2vwUgA0O24oLzGQpp1XKI6LLQ0.
 
You must log in or register to reply here.
Share:
Facebook X (Twitter) Reddit Pinterest Tumblr WhatsApp Email Share Link
  • Home
  • Forums
  • Software
  • PHP/JS/MySQL/Perl


About Warriors.to

It is a real Turkish hacking forum. It was established in 2022 and its aim is to respond to the attacks against Turkey and gather Turkish hackers under one roof.
Gerçek Türk Hack Forumudur. 2022 yılında kurulmuş olup amacı Türkiye'ye yönelik saldırılara karşılık vermek ve Türk hackerları tek çatı altında toplamaktır.

Forum Navigation

  •   Yönetici Listesi
  •   Üye Listesi
  •   Arama Yap

Yardım

  •   Forum Dökümanları

Hesap

  •   Kontrol Panel
  • English (US)
  • Contact us
  • Help
  • Home
  • RSS
Theme Made by W4H9LT 
Advanced Forum Stats, Awards System by AddonFlare - Premium XF2 Addons
Some of the add-ons on this site are powered by XenConcept™ ©2017-2025 XenConcept Ltd. (Details)
| Xenforo Add-ons © by ©XenTR
Top Bottom