Identicon (tinpo_identicon v0.1.0)

This application generates a visual representation of a hash value, usually of an IP address, that serves to identify a user of a computer while protecting the user's privacy or due to inability of user to upload real identity.

Link to this section Summary

Functions

This function with the help of pipe operator allow us to form our grid comprising 5 rows and 5 columns. The pipe works in following order: divide the hash values in threes --> produce mirrow values for each three i.e, turning 3 numbers to 5 numbers --> join each set together --> create a numbering system where first value is one, second is 2 and so on

This task helps to determine the pixel size of each grid in the entire space.

The function here transforms the input to md5 format which in turn converts the binary value to list.

The pipe here helps to run the entire program per input by passing from hash_input down to the last one which is save_image(input) and return the input as "ok" if it is correct.

This function helps the application to use 3 values to produce 5 values in row.

Erlang function is invoked here to convert our refined data to the image we set out to do.

In a bid to colour some portions of grid, the selection of which grid to be coloured is based on the type of number value. Only grid with non-odd numbers is coloured, hence why this function task is to remove odd grids and make them blank.

Ultimately, this function alllows each image created to be saved in a particular format.

This function selects the first three elements in the hash list and use as RGB colour value in HTML.

Link to this section Functions

Link to this function

build_grid(image)

This function with the help of pipe operator allow us to form our grid comprising 5 rows and 5 columns. The pipe works in following order: divide the hash values in threes --> produce mirrow values for each three i.e, turning 3 numbers to 5 numbers --> join each set together --> create a numbering system where first value is one, second is 2 and so on

Link to this function

build_pixel_map(image)

This task helps to determine the pixel size of each grid in the entire space.

Link to this function

hash_input(input)

The function here transforms the input to md5 format which in turn converts the binary value to list.

Example

iex(1)> Identicon.hash_input("olatinpo")
%Identicon.Image{
colour: nil,
grid: nil,
hex: [31, 201, 231, 9, 224, 13, 55, 164, 102, 113, 188, 89, 195, 193, 18, 130],
pixel_map: nil
}

The pipe here helps to run the entire program per input by passing from hash_input down to the last one which is save_image(input) and return the input as "ok" if it is correct.

Examples

iex> Identicon.main("olatinpo")
:ok
Link to this function

mirror_row(row)

This function helps the application to use 3 values to produce 5 values in row.

Link to this function

present_image(image)

Erlang function is invoked here to convert our refined data to the image we set out to do.

Link to this function

remove_odd_squares(image)

In a bid to colour some portions of grid, the selection of which grid to be coloured is based on the type of number value. Only grid with non-odd numbers is coloured, hence why this function task is to remove odd grids and make them blank.

Link to this function

save_image(image, input)

Ultimately, this function alllows each image created to be saved in a particular format.

for example Identicon.main("olatinpo") will be saved as olatinpo.png.

Link to this function

select_colour(image)

This function selects the first three elements in the hash list and use as RGB colour value in HTML.