apoc.hashing.fingerprinting
Function APOC Core
apoc.hashing.fingerprinting(object Any, config Map<String, Any>)
- calculates a MD5 checksum over a node or a relationship (identical entities share the same checksum).
Unlike apoc.hashing.fingerprint()
, this function supports a number of config parameters.
Unsuitable for cryptographic use-cases.
Config parameters
name | type | default | description |
---|---|---|---|
digestAlgorithm |
String |
"MD5" |
The algorithm used to compute the fingerprint. Supported values are: |
strategy |
String |
"LAZY" |
Defines the filtering behaviour of nodes/relationships. Supported values are:
|
nodeAllowMap |
Map<String, List<String>> |
{} |
Node label name mapped to a list of allowed properties for that label. |
nodeDisallowMap |
Map<String, List<String>> |
[] |
Node label name mapped to a list of properties to ignore for that label. |
relAllowMap |
Map<String, List<String>> |
{} |
Relationship type name mapped to a list of allowed properties for that type. |
relDisallowMap |
Map<String, List<String>> |
[] |
Relationship type name mapped to a list of properties to ignore for that type. |
mapAllowList |
List<String> |
[] |
A list of allowed keys when the object being hashed is a map. |
mapDisallowList |
List<String> |
[] |
A list of keys to ignore when the object being hashed is a map. |
allNodesAllowList |
List<String> |
[] |
A list of globally allowed node properties |
allNodesDisallowList |
List<String> |
[] |
A list of globally ignored node properties. |
allRelsAllowList |
List<String> |
[] |
A list of globally allowed relationship properties. |
allRelsDisallowList |
List<String> |
[] |
A list of globally ignored relationship properties. |
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);
The following generates the fingerprint for Ryan:
MATCH (person:Person {name: "Ryan"})
RETURN apoc.hashing.fingerprinting(person) AS output;
output |
---|
"D41D8CD98F00B204E9800998ECF8427E" |
The following generates the fingerprint for Ryan, using the EAGER
strategy, which includes node properties:
MATCH (person:Person {name: "Ryan"})
RETURN apoc.hashing.fingerprinting(person, {
strategy: "EAGER"
}) AS output;
output |
---|
"81C99DD6C9382C4E01A1873F9E818CE0" |
The following generates the fingerprint for Ryan, excluding the name
property:
MATCH (person:Person {name: "Ryan"})
RETURN apoc.hashing.fingerprinting(person, {
allNodesDisallowList: ["name"]
}) AS output;
output |
---|
"D41D8CD98F00B204E9800998ECF8427E" |
The following generates the fingerprint for Ryan, using the SHA-256
algorithm:
MATCH (person:Person {name: "Ryan"})
RETURN apoc.hashing.fingerprinting(person, {
digestAlgorithm: "SHA-256"
}) AS output;
output |
---|
"E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855" |
If we want less control over the generation of the fingerprint, see apoc.hashing.fingerprint.