What field type should be used for passwords in MySQL when using PHP crypt() [duplicate]

StackOverflow https://stackoverflow.com/questions/23435929

  •  14-07-2023
  •  | 
  •  

문제

Using PHP crypt() method I have a PHP script to store users encrypted passwords in MySQL database. What field type should I use to store the encrypted data?

도움이 되었습니까?

해결책

varchar(of sufficient length)

다른 팁

Use 'varchar'

In additon to wallyk's answer,
Exact lengths of encrytpted strings using crypt() are;

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. 

It depends on what type of encryption you are using but varbinary is appropriate in some situations.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top