atom_update_md5(+atom)

Update the current MD5 calculation with the value of the argument. The MD5 message-digest algorithm takes one or more Prolog atoms as input and calculates a 128 bit number which can act as a fingerprint of the input. It is conjectured that it is computationally infeasible to produce two different messages having the same message digest, or to produce a message having a given prespecified target message digest.
The MD5 algorithm is described in RFC 1321. RFC documents can be retrieved from www.rfc-editor.org/rfc.html.

After the predicate atom_update_md5/1 has been called one or more times the MD5 digest value can be calcuakted by calling the predicate atom_final_md5/1. The MD5 value is encoded with base64.

see also: atom_base64/2 atom_codes/2 atom_compress/2 atom_concat/3 atom_encrypt/3 atom_final_md5/1 atom_integers/2 atom_length/2 atom_reset_md5/0 char_code/2 number_chars/2 md5_file/2 number_codes/2 number_integers/2 sub_atom/5

Example
atom_update_md5('test'),
atom_final_md5(D).
D = 'CY9rzUYh03PK3k6DJie09g=='
atom_update_md5('test'),
atom_update_md5('test'),
atom_final_md5(D).
D = 'BaZxxmrv6hJMwIt26m0wuw=='

 

Exceptions  
Atom is a variable an instantiation_error exception is thrown
Atom is not an atom a type_error(atom, Atom) exception is thrown

 

 

info@trinc-prolog.com