Linux SRV-16 6.18.44-paas #1 SMP PREEMPT_DYNAMIC Thu Aug 13 10:08:12 UTC 2026 x86_64
/
proc
/
thread-self
/
root
/
proc
/
self
/
root
/
opt
/
ruby-2.6
/
usr
/
share
/
ri
/
2.6.0
/
system
/
String
/
//proc/thread-self/root/proc/self/root/opt/ruby-2.6/usr/share/ri/2.6.0/system/String/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::Verbatim; [0I"F* Behaviour of C's <code>crypt(3)</code> depends on the OS it is ;TI": run. The generated string lacks data portability. ;TI" ;TI"F* On some OSes such as Mac OS, <code>crypt(3)</code> never fails ;TI"6 (i.e. silently ends up in unexpected results). ;TI" ;TI"A* On some OSes such as Mac OS, <code>crypt(3)</code> is not ;TI" thread safe. ;TI" ;TI"F* So-called "traditional" usage of <code>crypt(3)</code> is very ;TI"F very very weak. According to its manpage, Linux's traditional ;TI"C <code>crypt(3)</code> output has only 2**56 variations; too ;TI"F easy to brute force today. And this is the default behaviour. ;TI" ;TI"D* In order to make things robust some OSes implement so-called ;TI"@ "modular" usage. To go through, you have to do a complex ;TI"A build-up of the <code>salt_str</code> parameter, by hand. ;TI"B Failure in generation of a proper salt string tends not to ;TI"> yield any errors; typos in parameters are normally not ;TI" detectable. ;TI" ;TI"I * For instance, in the following example, the second invocation ;TI"C of <code>String#crypt</code> is wrong; it has a typo in ;TI"E "round=" (lacks "s"). However the call does not fail and ;TI". something unexpected is generated. ;TI" ;TI"E "foo".crypt("$5$rounds=1000$salt$") # OK, proper usage ;TI"F "foo".crypt("$5$round=1000$salt$") # Typo not detected ;TI" ;TI"F* Even in the "modular" mode, some hash functions are considered ;TI"E archaic and no longer recommended at all; for instance module ;TI"C <code>$1$</code> is officially abandoned by its author: see ;TI"D http://phk.freebsd.dk/sagas/md5crypt_eol.html . For another ;TI"A instance module <code>$3$</code> is considered completely ;TI"+ broken: see the manpage of FreeBSD. ;TI" ;TI"D* On some OS such as Mac OS, there is no modular mode. Yet, as ;TI"C written above, <code>crypt(3)</code> on Mac OS never fails. ;TI"? This means even if you build up a proper salt string it ;TI"E generates a traditional DES hash anyways, and there is no way ;TI" for you to be aware of. ;TI" ;TI"D "foo".crypt("$5$rounds=1000$salt$") # => "$5fNPQMxC5j6." ;T:@format0o; ; [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@FFI"String;TcRDoc::NormalClassI" scanf;T0