NeoFaker.Crypto (neo_faker v0.9.0)

View Source

Functions for generating cryptographic hashes.

This module provides utilities to generate cryptographic hash values, such as MD5 and SHA-based hashes.

Summary

Functions

Generates a random MD5 hash.

Generates a random SHA-1 hash.

Generates a random SHA-256 hash.

Functions

md5(opts \\ [])

(since 0.3.1)
@spec md5(Keyword.t()) :: String.t()

Generates a random MD5 hash.

Returns a random MD5 hash string.

Options

The accepted options are:

  • :case - Specifies the character case of the output.

The values for :case can be:

  • :lower - Uses lowercase characters (default).
  • :upper - Uses uppercase characters.

Examples

iex> NeoFaker.Crypto.md5()
"afc4c626c55e4166421d82732163857d"

iex> NeoFaker.Crypto.md5(case: :upper)
"AFC4C626C55E4166421D82732163857D"

sha1(opts \\ [])

(since 0.3.1)
@spec sha1(Keyword.t()) :: String.t()

Generates a random SHA-1 hash.

This function behaves the same way as md5/1. See md5/1 for more details.

sha256(opts \\ [])

(since 0.3.1)
@spec sha256(Keyword.t()) :: String.t()

Generates a random SHA-256 hash.

This function behaves the same way as md5/1. See md5/1 for more details.