Ring/Lessons/Security and Internet Functions

Security and Internet Functions
This chapter contains the security and internet functions provided by the Ring programming language for Hashing, Encryption & Decryption. Before using the functions load the openssllib.ring library:


 * MD5
 * SHA1
 * SHA256
 * SHA512
 * SHA384
 * SHA224
 * Encrypt
 * Decrypt
 * Randbytes

Before using the functions load the internetlib.ring library:
 * Download
 * SendEmail

MD5 Function
We can calculate the MD5 hash using the MD5 Function

Syntax:

Example:

Output:

SHA1 Function
We can calculate the SHA1 hash using the SHA1 Function

Syntax:

Example:

Output:

SHA256 Function
We can calculate the SHA256 hash using the SHA256 Function

Syntax:

Example:

Output:

SHA512 Function
We can calculate the SHA512 hash using the SHA512 Function

Syntax:

Example:

Output:

SHA384 Function
We can calculate the SHA384 hash using the SHA384 Function

Syntax:

Example:

Output:

SHA224 Function
We can calculate the SHA224 hash using the SHA224 Function

Syntax:

Example:

Output:

Encrypt Function
We can use the Encrypt function to encrypts the data using the Blowfish algorithm.

Syntax:

Decrypt Function
We can use the Decrypt function to decrypt the data encrypted using the Encrypt function.

Syntax:

Encryption and Decryption Example
The next example demonstrates how to use the Encrypt and Decrypt functions.

These functions use the Blowfish algorithm.

File Hash
The next example demonstrates how to calculate the hash functions for files

Output:

Randbytes Function
We can generate a string of pseudo-random bytes using the Randbytes function.

Syntax:

Example:

Download Function
Syntax:

Example:

SendEmail Function
Syntax:

Example: