Для просмотра ссылки Войди или Зарегистрируйся is an exception tracer, i.e. a tool that installs hooks and catches exceptions being thrown, allowing you to generate a report on unhandled exceptions. However, it does provide various kinds of additional functionality that you can use in your apps. And one of those features is cryptography functions.
EurekaLog offers 3 units:
Important Note: please update EurekaLog to the most recent version. Not all features described here are available in previous versions, because some features were published specifically for this article.
Questions like this probably don't matter if you use cryptography functions exclusively inside your own apps. But as soon as you need to interact with other code - you immediately would have problems with the exact definition of the data.
Therefore, when you want exact result, you should operate on bytes, not strings. In Delphi, to operate on bytes, you can:
Specifically, EurekaLog functions accepts pointer+size, as well as overloaded option for RawByteString.
For example, if you try to obtain MD5-hash from "just" string 'Привет' in PHP - you would get 8a669e9418750c81ab90ae159a8ec410 - i.e. MD5-hash of UTF-8 encoded 'Привет'.
или Зарегистрируйся. And if you want to change the encoding in Delphi, you need Delphi encoding functions. Specifically, to Для просмотра ссылки Войди или Зарегистрируйся, Для просмотра ссылки Войди или Зарегистрируйся. In Delphi 2009 and up, you can also just declare the string type of the desired encoding and Для просмотра ссылки Войди или Зарегистрируйся.
The same is true in the opposite direction: the result of calling cryptographic functions is a set of bytes (hash, encrypted data, etc.). If you want to display these bytes to a human, you have to convert it to a string. It can be done, again, in different ways. For example, you can use the built-in function Для просмотра ссылки Войдиили Зарегистрируйся or its more convenient equivalents: HexEncodeString/HexEncodeToString from EurekaLog. You can use Base64EncodeString/Base64EncodeToString from EurekaLog. If, suddenly, you need to convert data from/to RawByteString, then EurekaLog has RAWToString/RAWFromString helpers. Also you may want to load/save small data directly to files - there is FileToString/StringToFile for that (from the ECompatibility unit).
Examples of using the mentioned functions can be found below.
EurekaLog offers 3 units:
- Для просмотра ссылки Войди
или Зарегистрируйся - contains Для просмотра ссылки Войдиили Зарегистрируйся; - Для просмотра ссылки Войди
или Зарегистрируйся - contains Для просмотра ссылки Войдиили Зарегистрируйся; - Для просмотра ссылки Войди
или Зарегистрируйся - contains Для просмотра ссылки Войдиили Зарегистрируйся.
Important Note: please update EurekaLog to the most recent version. Not all features described here are available in previous versions, because some features were published specifically for this article.
Encoding
Before talking about cryptography, you need to take decicion about data representation. For example, suppose you want to get the MD5 hash of the 'Привет' string (means "Hello" in Russian, reads as "Privet", stress on the second syllable). What exactly are you gonna feed into hash function? $CF$F0$E8$E2$E5$F2 bytes? (which is 'Привет' encoded via ANSI/Windows-1251) Or $1F$04$40$04$38$04$32$04$35$04$42$04 bytes? ('Привет' in Unicode/UTF-16) Or may be $D0$9F$D1$80$D0$B8 bytes ('Привет' in UTF-8)? Depending on how you answer this question, you will get different results. For example, the MD5 hash for the 'Привет' in UTF-16 would be 8EFA2364EE560EE1B862ECC8D430C9AD, for 'Привет' in ANSI - 43A3F987A7AF93811B7682E43ED0752A, and for 'Привет' in UTF-8 - 8A669E9418750C81AB90AE159A8EC410.Questions like this probably don't matter if you use cryptography functions exclusively inside your own apps. But as soon as you need to interact with other code - you immediately would have problems with the exact definition of the data.
Therefore, when you want exact result, you should operate on bytes, not strings. In Delphi, to operate on bytes, you can:
- Use pointer + size of data: (const ABuffer: Pointer; const ABufferSize: Cardinal);
- Use Для просмотра ссылки Войди
или Зарегистрируйся (array of Byte - dynamic byte array); - Use Для просмотра ссылки Войди
или Зарегистрируйся; - Use Для просмотра ссылки Войди
или Зарегистрируйся (its sub-classes).
Specifically, EurekaLog functions accepts pointer+size, as well as overloaded option for RawByteString.
For example, if you try to obtain MD5-hash from "just" string 'Привет' in PHP - you would get 8a669e9418750c81ab90ae159a8ec410 - i.e. MD5-hash of UTF-8 encoded 'Привет'.
If you want to change the encoding in PHP, you will need to call something like Для просмотра ссылки ВойдиFrom where you can also conclude that strings in PHP are stored in UTF-8; for comparison: Delphi stores strings as UTF-16 (since Delphi 2009) or ANSI (Delphi 2007 and earlier).
The same is true in the opposite direction: the result of calling cryptographic functions is a set of bytes (hash, encrypted data, etc.). If you want to display these bytes to a human, you have to convert it to a string. It can be done, again, in different ways. For example, you can use the built-in function Для просмотра ссылки Войди
Examples of using the mentioned functions can be found below.