Cryptographic API Functions/en

Aus expecco Wiki (Version 2.x)
Version vom 18. November 2021, 15:50 Uhr von Cg (Diskussion | Beiträge) (Die Seite wurde neu angelegt: „All algorithms are accessed the same way, by either sending one of the convenient utility messages to a hash-stream-class, or by instantiating a hash stream an…“)
(Unterschied) ← Nächstältere Version | Aktuelle Version (Unterschied) | Nächstjüngere Version → (Unterschied)
Zur Navigation springen Zur Suche springen

All algorithms are accessed the same way, by either sending one of the convenient utility messages to a hash-stream-class, or by instantiating a hash stream and sending it the data to be hashed.

The utility messages are easier to use, but require the data to be hashed to be already present. The instance messages allow for streams of unknown length to be hashed, to preinitialize the parameters and to fetch/reset the hash value during the operation.

Available hash classes are: MD5Stream, SHA1Stream, etc. (open a browser or evaluate "HashStream allSubclasses" to see them all).

Utility[Bearbeiten]

HashStreamClass hashValueOf: aStringOrByteArray

Returns the hash value as a byte vector (the length of the vector depends on the algorithm).
Example:
MD5Stream hashValueOf: 'hello world'
   => #[177 10 141 177 100 224 117 65 5 183 169 155 231 46 63 229]

SHA1Stream hashValueOf: 'hello world'
   => #[42 174 108 53 201 79 207 180 21 219 233 95 64 139 156 233 30 232 70 237]

HashStreamClass hashValueHexString: aStringOrByteArray

Returns the hash value as a hex string.
Example:
MD5Stream hashValueHexString: 'hello world'
   => 'b10a8db164e0754105b7a99be72e3fe5'

SHA1Stream hashValueHexString: 'hello world'
   => '2aae6c35c94fcfb415dbe95f408b9ce91ee846ed'



Copyright © 2014-2024 eXept Software AG