Gestionnaire de fichiers - Editer - /opt/cpanel/ea-ruby24/root/usr/share/ri/system/OpenSSL/Digest/cdesc-Digest.ri
Arrière
U:RDoc::NormalClass[iI"Digest:ETI"OpenSSL::Digest;TI"OpenSSL::Digest::Class;To:RDoc::Markup::Document:@parts[o;;[ : @fileI"&ext/openssl/lib/openssl/digest.rb;T:0@omit_headings_from_table_of_contents_below0o;;[2o:RDoc::Markup::Paragraph;[ I"FOpenSSL::Digest allows you to compute message digests (sometimes ;TI"Ainterchangeably called "hashes") of arbitrary data that are ;TI"Icryptographically secure, i.e. a Digest implements a secure one-way ;TI"function.;To:RDoc::Markup::BlankLine o;;[I"DOne-way functions offer some useful properties. E.g. given two ;TI"Edistinct inputs the probability that both yield the same output ;TI"Jis highly unlikely. Combined with the fact that every message digest ;TI"Jalgorithm has a fixed-length output of just a few bytes, digests are ;TI"Joften used to create unique identifiers for arbitrary data. A common ;TI"Jexample is the creation of a unique id for binary documents that are ;TI"stored in a database.;T@o;;[ I"LAnother useful characteristic of one-way functions (and thus the name) ;TI"Fis that given a digest there is no indication about the original ;TI"Mdata that produced it, i.e. the only way to identify the original input ;TI"Fis to "brute-force" through every possible combination of inputs.;T@o;;[I"HThese characteristics make one-way functions also ideal companions ;TI"Gfor public key signature algorithms: instead of signing an entire ;TI"Ldocument, first a hash of the document is produced with a considerably ;TI"Jfaster message digest algorithm and only the few bytes of its output ;TI"Jneed to be signed using the slower public key algorithm. To validate ;TI"Lthe integrity of a signed document, it suffices to re-compute the hash ;TI":and verify that it is equal to that in the signature.;T@o;;[I"7Among the supported message digest algorithms are:;To:RDoc::Markup::List: @type:BULLET:@items[ o:RDoc::Markup::ListItem:@label0;[o;;[I"1SHA, SHA1, SHA224, SHA256, SHA384 and SHA512;To;;0;[o;;[I"MD2, MD4, MDC2 and MD5;To;;0;[o;;[I"RIPEMD160;To;;0;[o;;[I"HDSS, DSS1 (Pseudo algorithms to be used for DSA signatures. DSS is ;TI",equal to SHA and DSS1 is equal to SHA1);T@o;;[I"GFor each of these algorithms, there is a sub-class of Digest that ;TI"*can be instantiated as simply as e.g.;T@o:RDoc::Markup::Verbatim;[I"(digest = OpenSSL::Digest::SHA1.new ;T:@format0S:RDoc::Markup::Heading: leveli: textI"+Mapping between Digest class and sn/ln;T@o;;[I"=The sn (short names) and ln (long names) are defined in ;TI"B<openssl/object.h> and <openssl/obj_mac.h>. They are textual ;TI"Hrepresentations of ASN.1 OBJECT IDENTIFIERs. Each supported digest ;TI"Ialgorithm has an OBJECT IDENTIFIER associated to it and those again ;TI"-have short/long names assigned to them. ;TI"CE.g. the OBJECT IDENTIFIER for SHA-1 is 1.3.14.3.2.26 and its ;TI"'sn is "SHA1" and its ln is "sha1".;TS;;i ;I"MD2;To; ;;;[o;;0;[o;;[I"sn: MD2;To;;0;[o;;[I"ln: md2;TS;;i ;I"MD4;To; ;;;[o;;0;[o;;[I"sn: MD4;To;;0;[o;;[I"ln: md4;TS;;i ;I"MD5;To; ;;;[o;;0;[o;;[I"sn: MD5;To;;0;[o;;[I"ln: md5;TS;;i ;I"SHA;To; ;;;[o;;0;[o;;[I"sn: SHA;To;;0;[o;;[I"ln: SHA;TS;;i ;I" SHA-1;To; ;;;[o;;0;[o;;[I" sn: SHA1;To;;0;[o;;[I" ln: sha1;TS;;i ;I"SHA-224;To; ;;;[o;;0;[o;;[I"sn: SHA224;To;;0;[o;;[I"ln: sha224;TS;;i ;I"SHA-256;To; ;;;[o;;0;[o;;[I"sn: SHA256;To;;0;[o;;[I"ln: sha256;TS;;i ;I"SHA-384;To; ;;;[o;;0;[o;;[I"sn: SHA384;To;;0;[o;;[I"ln: sha384;TS;;i ;I"SHA-512;To; ;;;[o;;0;[o;;[I"sn: SHA512;To;;0;[o;;[I"ln: sha512;T@o;;[I"E"Breaking" a message digest algorithm means defying its one-way ;TI"Kfunction characteristics, i.e. producing a collision or finding a way ;TI"Gto get to the original data by means that are more efficient than ;TI"Gbrute-forcing etc. Most of the supported digest algorithms can be ;TI"Iconsidered broken in this sense, even the very popular MD5 and SHA1 ;TI"Jalgorithms. Should security be your highest concern, then you should ;TI"7probably rely on SHA224, SHA256, SHA384 or SHA512.;T@S;;i;I"Hashing a file;T@o;;[I""data = File.read('document') ;TI"*sha256 = OpenSSL::Digest::SHA256.new ;TI""digest = sha256.digest(data) ;T;0S;;i;I"+Hashing several pieces of data at once;T@o;;[ I" data1 = File.read('file1') ;TI" data2 = File.read('file2') ;TI" data3 = File.read('file3') ;TI"*sha256 = OpenSSL::Digest::SHA256.new ;TI"sha256 << data1 ;TI"sha256 << data2 ;TI"sha256 << data3 ;TI"digest = sha256.digest ;T;0S;;i;I"Reuse a Digest instance;T@o;;[I" data1 = File.read('file1') ;TI"*sha256 = OpenSSL::Digest::SHA256.new ;TI"$digest1 = sha256.digest(data1) ;TI" ;TI" data2 = File.read('file2') ;TI"sha256.reset ;TI"#digest2 = sha256.digest(data2);T;0; I"ext/openssl/ossl_digest.c;T; 0; 0; 0[ [ [ [[I" class;T[[:public[[I"digest;FI"&ext/openssl/lib/openssl/digest.rb;T[I"new;TI"ext/openssl/ossl_digest.c;T[:protected[ [:private[ [I" instance;T[[;[[I"<<;T@[I"block_length;T@[I"digest_length;T@[I" name;T@[I" reset;T@[I"update;T@[;[ [;[[I"finish;T@[ [U:RDoc::Context::Section[i 0o;;[ ; 0; 0[ @I"ext/openssl/ossl.c;TI"lib/drb/ssl.rb;TI"lib/webrick/ssl.rb;TI"OpenSSL;FcRDoc::NormalModule
| ver. 1.4 |
Github
|
.
| PHP 8.0.30 | Génération de la page: 2.55 |
proxy
|
phpinfo
|
Réglages