apoc.hashing.fingerprint
Function APOC Core
calculate a checksum (md5) over a node or a relationship. This deals gracefully with array properties. Two identical entities do share the same hash. MD5 is a weak hashing algorithm which is unsuitable for cryptographic use-cases.
Signature
apoc.hashing.fingerprint(some object :: ANY?, propertyExcludes = [] :: LIST? OF STRING?) :: (STRING?)
Usage Examples
The examples in this section are based on the following sample graph:
MERGE (joe:Person {name: "Joe"})
MERGE (ryan:Person {name: "Ryan"})
MERGE (ryan)-[:FOLLOWS {since: datetime("2020-11-04")}]->(joe);
MATCH (person:Person {name: "Ryan"})
RETURN apoc.hashing.fingerprint(person) AS output;
output |
---|
"81C99DD6C9382C4E01A1873F9E818CE0" |
MATCH ()-[rel:FOLLOWS]->()
RETURN apoc.hashing.fingerprint(rel) AS output;
output |
---|
"C5A4B9FA273CC723D96BF93FFDD42858" |
RETURN apoc.hashing.fingerprint({name: "Michael"}) AS output;
output |
---|
"F582CEF35FA83F3691BB756313191948" |
If we want more control over fingerprint generation, see apoc.hashing.fingerprinting.