You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-[Victor Hahn Castell](http://hahncastell.de) for the tree view and major contributions:
451
-
-[nfvs](https://github.com/nfvs) for Travis-CI setup script.
452
-
-[brbsix](https://github.com/brbsix) for initial Py3 porting.
453
-
-[WangFenjin](https://github.com/WangFenjin) for unicode support.
454
-
-[timoilya](https://github.com/timoilya) for comparing list of sets when ignoring order.
455
-
-[Bernhard10](https://github.com/Bernhard10) for significant digits comparison.
456
-
-[b-jazz](https://github.com/b-jazz) for PEP257 cleanup, Standardize on full names, fixing line endings.
457
-
-[finnhughes](https://github.com/finnhughes) for fixing __slots__
458
-
-[moloney](https://github.com/moloney) for Unicode vs. Bytes default
459
-
-[serv-inc](https://github.com/serv-inc) for adding help(deepdiff)
460
-
-[movermeyer](https://github.com/movermeyer) for updating docs
461
-
-[maxrothman](https://github.com/maxrothman) for search in inherited class attributes
462
-
-[maxrothman](https://github.com/maxrothman) for search for types/objects
463
-
-[MartyHub](https://github.com/MartyHub) for exclude regex paths
464
-
-[sreecodeslayer](https://github.com/sreecodeslayer) for DeepSearch match_string
465
-
- Brian Maissy [brianmaissy](https://github.com/) for weakref fix, enum tests
466
-
- Bartosz Borowik [boba-2](https://github.com/boba-2) for Exclude types fix when ignoring order
467
-
- Brian Maissy [brianmaissy](https://github.com/brianmaissy) for fixing classes which inherit from classes with slots didn't have all of their slots compared
468
-
- Juan Soler [Soleronline](https://github.com/Soleronline) for adding ignore_type_number
469
-
-[mthaddon](https://github.com/mthaddon) for adding timedelta diffing support
470
-
-[Necrophagos](https://github.com/Necrophagos) for Hashing of the number 1 vs. True
471
-
-[gaal-dev](https://github.com/gaal-dev) for adding exclude_obj_callback
472
-
- Ivan Piskunov [van-ess0](https://github.com/van-ess0) for deprecation warning enhancement.
473
-
- Michał Karaś [MKaras93](https://github.com/MKaras93) for the pretty view
474
-
- Christian Kothe [chkothe](https://github.com/chkothe) for the basic support for diffing numpy arrays
475
-
-[Timothy](https://github.com/timson) for truncate_datetime
476
-
-[d0b3rm4n](https://github.com/d0b3rm4n) for bugfix to not apply format to non numbers.
477
-
-[MyrikLD](https://github.com/MyrikLD) for Bug Fix NoneType in ignore type groups
422
+
Please take a look at the [AUTHORS](AUTHORS.md) file.
Copy file name to clipboardExpand all lines: docs/deephash_doc.rst
+9-12Lines changed: 9 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,10 +7,7 @@ The main usage of DeepHash is to calculate the hash of otherwise unhashable obje
7
7
For example you can use DeepHash to calculate the hash of a set or a dictionary!
8
8
9
9
At the core of it, DeepHash is a deterministic serialization of your object into a string so it
10
-
can be passed to a hash function. By default it uses Murmur 3 128 bit hash function which is a
11
-
fast, non-cryptographic hashing function. You have the option to pass any another hashing function to be used instead.
12
-
13
-
If it can't find Murmur3 package (mmh3) installed, it uses Python's built-in SHA256 for hashing which is considerably slower than Murmur3. So it is advised that you install Murmur3 by running `pip install 'deepdiff[murmur]`
10
+
can be passed to a hash function. By default it uses SHA256. You have the option to pass any another hashing function to be used instead.
14
11
15
12
**Import**
16
13
>>> from deepdiff import DeepHash
@@ -39,20 +36,21 @@ exclude_obj_callback
39
36
A function that takes the object and its path and returns a Boolean. If True is returned, the object is excluded from the results, otherwise it is included.
40
37
This is to give the user a higher level of control than one can achieve via exclude_paths, exclude_regex_paths or other means.
hasher is the hashing function. The default is DeepHash.murmur3_128bit.
39
+
hasher: function. default = DeepHash.sha256hex
40
+
hasher is the hashing function. The default is DeepHash.sha256hex.
44
41
But you can pass another hash function to it if you want.
45
42
For example a cryptographic hash function or Python's builtin hash function.
46
43
All it needs is a function that takes the input in string format and returns the hash.
47
44
48
45
You can use it by passing: hasher=hash for Python's builtin hash.
49
46
50
-
The following alternatives are already provided:
47
+
The following alternative is already provided:
51
48
52
-
- hasher=DeepHash.murmur3_128bit
53
-
- hasher=DeepHash.murmur3_64bit
54
49
- hasher=DeepHash.sha1hex
55
50
51
+
Note that prior to DeepDiff 5.2, Murmur3 was the default hash function.
52
+
But Murmur3 is removed from DeepDiff dependencies since then.
53
+
56
54
ignore_repetition: Boolean, default = True
57
55
If repetitions in an iterable should cause the hash of iterable to be different.
58
56
Note that the deepdiff diffing functionality lets this to be the default at all times.
@@ -165,10 +163,9 @@ But with DeepHash:
165
163
166
164
At first it might seem weird why DeepHash(obj)[obj] but remember that DeepHash(obj) is a dictionary of hashes of all other objects that obj contains too.
167
165
168
-
The result hash is 34150898645750099477987229399128149852 which is generated by
169
-
Murmur 3 128bit hashing algorithm. If you prefer to use another hashing algorithm, you can pass it using the hasher parameter. Read more about Murmur3 here: https://en.wikipedia.org/wiki/MurmurHash
166
+
The result hash is 34150898645750099477987229399128149852. If you prefer to use another hashing algorithm, you can pass it using the hasher parameter.
170
167
171
-
If you do a deep copy of obj, it should still give you the same hash:
168
+
If you do a deep copy of the obj, it should still give you the same hash:
:ref:`group_by_label` can be used when dealing with list of dictionaries to convert them to group them by value defined in group_by. The common use case is when reading data from a flat CSV and primary key is one of the columns in the CSV. We want to use the primary key to group the rows instead of CSV row number.
59
59
60
-
hasher: default = DeepHash.murmur3_128bit
61
-
Hash function to be used. If you don't want Murmur3, you can use Python's built-in hash function
60
+
hasher: default = DeepHash.sha256hex
61
+
Hash function to be used. If you don't want SHA256, you can use your own hash function
62
62
by passing hasher=hash. This is for advanced usage and normally you don't need to modify it.
0 commit comments