⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.93
Server IP:
65.108.141.171
Server:
Linux server.heloix.com 5.4.0-214-generic #234-Ubuntu SMP Fri Mar 14 23:50:27 UTC 2025 x86_64
Server Software:
Apache
PHP Version:
7.4.33
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
usr
/
share
/
ri
/
2.7.0
/
system
/
String
/
View File Name :
crypt-i.ri
U:RDoc::AnyMethod[iI" crypt:ETI"String#crypt;TF:publico:RDoc::Markup::Document:@parts[ o:RDoc::Markup::Paragraph; [I"CReturns the string generated by calling <code>crypt(3)</code> ;TI"9standard library function with <code>str</code> and ;TI"H<code>salt_str</code>, in this order, as its arguments. Please do ;TI"Fnot use this method any longer. It is legacy; provided only for ;TI"Fbackward compatibility with ruby scripts in earlier days. It is ;TI"=bad to use in contemporary programs for several reasons:;To:RDoc::Markup::BlankLine o:RDoc::Markup::List: @type:BULLET:@items[o:RDoc::Markup::ListItem:@label0; [o; ; [I"DBehaviour of C's <code>crypt(3)</code> depends on the OS it is ;TI"7run. The generated string lacks data portability.;T@o;;0; [o; ; [I"DOn some OSes such as Mac OS, <code>crypt(3)</code> never fails ;TI"3(i.e. silently ends up in unexpected results).;T@o;;0; [o; ; [I"?On some OSes such as Mac OS, <code>crypt(3)</code> is not ;TI"thread safe.;T@o;;0; [o; ; [ I"DSo-called "traditional" usage of <code>crypt(3)</code> is very ;TI"Dvery very weak. According to its manpage, Linux's traditional ;TI"A<code>crypt(3)</code> output has only 2**56 variations; too ;TI"Ceasy to brute force today. And this is the default behaviour.;T@o;;0; [o; ; [I"BIn order to make things robust some OSes implement so-called ;TI">"modular" usage. To go through, you have to do a complex ;TI"?build-up of the <code>salt_str</code> parameter, by hand. ;TI"@Failure in generation of a proper salt string tends not to ;TI"<yield any errors; typos in parameters are normally not ;TI"detectable.;T@o;; ;;[o;;0; [o; ; [ I"CFor instance, in the following example, the second invocation ;TI"@of String#crypt is wrong; it has a typo in "round=" (lacks ;TI"D"s"). However the call does not fail and something unexpected ;TI"is generated.;T@o:RDoc::Markup::Verbatim; [I"<"foo".crypt("$5$rounds=1000$salt$") # OK, proper usage ;TI"="foo".crypt("$5$round=1000$salt$") # Typo not detected ;T:@format0o;;0; [o; ; [I"DEven in the "modular" mode, some hash functions are considered ;TI"Carchaic and no longer recommended at all; for instance module ;TI"A<code>$1$</code> is officially abandoned by its author: see ;TI"Bhttp://phk.freebsd.dk/sagas/md5crypt_eol.html . For another ;TI"?instance module <code>$3$</code> is considered completely ;TI"(broken: see the manpage of FreeBSD.;T@o;;0; [o; ; [ I"BOn some OS such as Mac OS, there is no modular mode. Yet, as ;TI"Awritten above, <code>crypt(3)</code> on Mac OS never fails. ;TI"=This means even if you build up a proper salt string it ;TI"Cgenerates a traditional DES hash anyways, and there is no way ;TI"for you to be aware of.;T@o;; [I">"foo".crypt("$5$rounds=1000$salt$") # => "$5fNPQMxC5j6." ;T;0o; ; [I"HIf for some reason you cannot migrate to other secure contemporary ;TI"Cpassword hashing algorithms, install the string-crypt gem and ;TI"><code>require 'string/crypt'</code> to continue using it.;T: @fileI" string.c;T:0@omit_headings_from_table_of_contents_below0I"&str.crypt(salt_str) -> new_str ;T0[ I" (p1);T@cFI"String;TcRDoc::NormalClass00