I'm trying to write a md5
predicate that verifies the following:
md5("my string", "my md5").
A truth instance of such predicate would be
md5("long live and prosper", "bf1835ce984d2a97d31409394fe00e9a").
I looked into docs, and I found this: http://www.swi-prolog.org/pldoc/doc_for?object=crypt/2
?- phrase("$1$", E, _),
crypt("My password", E),
format('~s~n', [E]).
anyway, I cannot get it to work. I'm sure I'm missing something as I'm quite new in prolog. Any hint?
EDIT
For a better explanation, I assume to create a clause similar to this:
md5(P, M):-
phrase("$1$", E, _),
crypt(P, E),
name(M, E),
format('~s~n', [E]).
?- md5("long live and prosper", "bf1835ce984d2a97d31409394fe00e9a").
$1$AtnbRJvB$cZ4gZvG2Glelv8hfWztcY/
false.
Thanks
(Prolog implementation: swi-prolog on Mac OSX El Capitan)