mirror of
https://github.com/urbit/ares.git
synced 2024-11-24 17:56:38 +03:00
Merge pull request #257 from zorp-corp/ea/vendor-murmur3
Re-vendor murmur3 into sword repo
This commit is contained in:
commit
ea842ec171
126
Cargo.lock
generated
126
Cargo.lock
generated
@ -421,7 +421,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3"
|
||||
dependencies = [
|
||||
"generic-array",
|
||||
"rand_core",
|
||||
"rand_core 0.6.4",
|
||||
"typenum",
|
||||
]
|
||||
|
||||
@ -528,6 +528,16 @@ version = "1.13.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0"
|
||||
|
||||
[[package]]
|
||||
name = "env_logger"
|
||||
version = "0.7.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36"
|
||||
dependencies = [
|
||||
"log",
|
||||
"regex",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "errno"
|
||||
version = "0.3.9"
|
||||
@ -560,6 +570,17 @@ dependencies = [
|
||||
"version_check",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "getrandom"
|
||||
version = "0.1.16"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"libc",
|
||||
"wasi 0.9.0+wasi-snapshot-preview1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "getrandom"
|
||||
version = "0.2.15"
|
||||
@ -568,7 +589,7 @@ checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"libc",
|
||||
"wasi",
|
||||
"wasi 0.11.0+wasi-snapshot-preview1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -630,7 +651,7 @@ dependencies = [
|
||||
"cfg-if",
|
||||
"criterion 0.3.6",
|
||||
"num-traits",
|
||||
"rand",
|
||||
"rand 0.8.5",
|
||||
"serde",
|
||||
"serde_test",
|
||||
"static_assertions",
|
||||
@ -774,7 +795,17 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "murmur3"
|
||||
version = "0.5.2"
|
||||
source = "git+https://github.com/tloncorp/murmur3?rev=7878a0f#7878a0fbecf465720891b625f1a1fc3e19b6a960"
|
||||
dependencies = [
|
||||
"murmur3-sys",
|
||||
"quickcheck",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "murmur3-sys"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"bindgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "nom"
|
||||
@ -890,10 +921,22 @@ dependencies = [
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "1.0.36"
|
||||
name = "quickcheck"
|
||||
version = "0.9.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7"
|
||||
checksum = "a44883e74aa97ad63db83c4bf8ca490f02b2fc02f92575e720c8551e843c945f"
|
||||
dependencies = [
|
||||
"env_logger",
|
||||
"log",
|
||||
"rand 0.7.3",
|
||||
"rand_core 0.5.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "1.0.37"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
]
|
||||
@ -904,6 +947,19 @@ version = "0.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09"
|
||||
|
||||
[[package]]
|
||||
name = "rand"
|
||||
version = "0.7.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03"
|
||||
dependencies = [
|
||||
"getrandom 0.1.16",
|
||||
"libc",
|
||||
"rand_chacha 0.2.2",
|
||||
"rand_core 0.5.1",
|
||||
"rand_hc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand"
|
||||
version = "0.8.5"
|
||||
@ -911,8 +967,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"rand_chacha",
|
||||
"rand_core",
|
||||
"rand_chacha 0.3.1",
|
||||
"rand_core 0.6.4",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_chacha"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402"
|
||||
dependencies = [
|
||||
"ppv-lite86",
|
||||
"rand_core 0.5.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -922,7 +988,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"
|
||||
dependencies = [
|
||||
"ppv-lite86",
|
||||
"rand_core",
|
||||
"rand_core 0.6.4",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_core"
|
||||
version = "0.5.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19"
|
||||
dependencies = [
|
||||
"getrandom 0.1.16",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -931,7 +1006,16 @@ version = "0.6.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
|
||||
dependencies = [
|
||||
"getrandom",
|
||||
"getrandom 0.2.15",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_hc"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c"
|
||||
dependencies = [
|
||||
"rand_core 0.5.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -1040,9 +1124,9 @@ checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b"
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.208"
|
||||
version = "1.0.209"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cff085d2cb684faa248efb494c39b68e522822ac0de72ccf08109abde717cfb2"
|
||||
checksum = "99fce0ffe7310761ca6bf9faf5115afbc19688edd00171d81b1bb1b116c63e09"
|
||||
dependencies = [
|
||||
"serde_derive",
|
||||
]
|
||||
@ -1059,9 +1143,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "serde_derive"
|
||||
version = "1.0.208"
|
||||
version = "1.0.209"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "24008e81ff7613ed8e5ba0cfaf24e2c2f1e5b8a0495711e44fcd4882fca62bcf"
|
||||
checksum = "a5831b979fd7b5439637af1752d535ff49f4860c0f341d1baeb6faf0f4242170"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@ -1070,9 +1154,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "serde_json"
|
||||
version = "1.0.125"
|
||||
version = "1.0.127"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "83c8e735a073ccf5be70aa8066aa984eaf2fa000db6c8d0100ae605b366d31ed"
|
||||
checksum = "8043c06d9f82bd7271361ed64f415fe5e12a77fdb52e573e7f06a516dea329ad"
|
||||
dependencies = [
|
||||
"itoa",
|
||||
"memchr",
|
||||
@ -1307,6 +1391,12 @@ dependencies = [
|
||||
"winapi-util",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasi"
|
||||
version = "0.9.0+wasi-snapshot-preview1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519"
|
||||
|
||||
[[package]]
|
||||
name = "wasi"
|
||||
version = "0.11.0+wasi-snapshot-preview1"
|
||||
@ -1519,7 +1609,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c7e468321c81fb07fa7f4c636c3972b9100f0346e5b6a9f2bd0603a52f7ed277"
|
||||
dependencies = [
|
||||
"curve25519-dalek",
|
||||
"rand_core",
|
||||
"rand_core 0.6.4",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -7,4 +7,6 @@ members = [
|
||||
"rust/sword_guard",
|
||||
"rust/sword_macros",
|
||||
"rust/sword_pma",
|
||||
"rust/murmur3",
|
||||
"rust/murmur3/murmur3-sys",
|
||||
]
|
||||
|
14
rust/murmur3/.gitignore
vendored
Normal file
14
rust/murmur3/.gitignore
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
# Compiled files
|
||||
*.o
|
||||
*.so
|
||||
*.rlib
|
||||
*.dll
|
||||
|
||||
# Executables
|
||||
*.exe
|
||||
|
||||
# Generated by Cargo
|
||||
/target/
|
||||
Cargo.lock
|
||||
|
||||
.idea
|
19
rust/murmur3/Cargo.toml
Normal file
19
rust/murmur3/Cargo.toml
Normal file
@ -0,0 +1,19 @@
|
||||
[package]
|
||||
name = "murmur3"
|
||||
version = "0.5.2"
|
||||
authors = [ "Stu Small <stuart.alan.small@gmail.com>" ]
|
||||
description = "A rust implementation of Murmur3 hash"
|
||||
repository = "https://github.com/stusmall/murmur3"
|
||||
keywords = ["hash","murmur3","murmur"]
|
||||
license = "MIT/Apache-2.0"
|
||||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
|
||||
[dev-dependencies]
|
||||
murmur3-sys = { path = "./murmur3-sys"}
|
||||
quickcheck = "0.9"
|
||||
|
||||
[profile.bench]
|
||||
lto = true
|
||||
codegen-units = 1
|
202
rust/murmur3/LICENSE-APACHE
Normal file
202
rust/murmur3/LICENSE-APACHE
Normal file
@ -0,0 +1,202 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "{}"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright {yyyy} {name of copyright owner}
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
25
rust/murmur3/LICENSE-MIT
Normal file
25
rust/murmur3/LICENSE-MIT
Normal file
@ -0,0 +1,25 @@
|
||||
Copyright (c) 2016 Stu Small
|
||||
|
||||
Permission is hereby granted, free of charge, to any
|
||||
person obtaining a copy of this software and associated
|
||||
documentation files (the "Software"), to deal in the
|
||||
Software without restriction, including without
|
||||
limitation the rights to use, copy, modify, merge,
|
||||
publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software
|
||||
is furnished to do so, subject to the following
|
||||
conditions:
|
||||
|
||||
The above copyright notice and this permission notice
|
||||
shall be included in all copies or substantial portions
|
||||
of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
|
||||
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
|
||||
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
||||
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
|
||||
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
|
||||
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
7
rust/murmur3/README.md
Normal file
7
rust/murmur3/README.md
Normal file
@ -0,0 +1,7 @@
|
||||
# murmur3
|
||||
|
||||
**Vendored version required by zorp-corp/sword**
|
||||
|
||||
This is a rust implementation of the fast, non-cryptographic hash [murmur3](https://en.wikipedia.org/wiki/MurmurHash).
|
||||
|
||||
See the [API docs](https://docs.rs/murmur3/) for example code.
|
113
rust/murmur3/benches/bench.rs
Normal file
113
rust/murmur3/benches/bench.rs
Normal file
@ -0,0 +1,113 @@
|
||||
#![feature(test)]
|
||||
extern crate murmur3_sys;
|
||||
extern crate test;
|
||||
|
||||
use std::io::Cursor;
|
||||
use test::Bencher;
|
||||
|
||||
extern crate murmur3;
|
||||
|
||||
use murmur3::*;
|
||||
|
||||
use murmur3_sys::MurmurHash3_x86_32;
|
||||
|
||||
#[bench]
|
||||
fn bench_32(b: &mut Bencher) {
|
||||
let string: &[u8] =
|
||||
test::black_box(b"Lorem ipsum dolor sit amet, consectetur adipisicing elit");
|
||||
b.bytes = string.len() as u64;
|
||||
b.iter(|| {
|
||||
let mut tmp = Cursor::new(&string[0..string.len()]);
|
||||
murmur3_32(&mut tmp, 0)
|
||||
});
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn bench_32_slice(b: &mut Bencher) {
|
||||
let string: &[u8] =
|
||||
test::black_box(b"Lorem ipsum dolor sit amet, consectetur adipisicing elit");
|
||||
b.bytes = string.len() as u64;
|
||||
b.iter(|| {
|
||||
let tmp = &string[0..string.len()];
|
||||
murmur3_32_of_slice(tmp, 0);
|
||||
});
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn bench_c_32(b: &mut Bencher) {
|
||||
let string: &[u8] =
|
||||
test::black_box(b"Lorem ipsum dolor sit amet, consectetur adipisicing elit");
|
||||
b.bytes = string.len() as u64;
|
||||
b.iter(|| {
|
||||
unsafe {
|
||||
let output: [u8; 4] = [0; 4];
|
||||
MurmurHash3_x86_32(
|
||||
string.as_ptr() as _,
|
||||
string.len() as i32,
|
||||
0,
|
||||
output.as_ptr() as *mut _,
|
||||
);
|
||||
output[0]
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn bench_x86_128(b: &mut Bencher) {
|
||||
let string: &[u8] =
|
||||
test::black_box(b"Lorem ipsum dolor sit amet, consectetur adipisicing elit");
|
||||
b.bytes = string.len() as u64;
|
||||
b.iter(|| {
|
||||
let mut tmp = Cursor::new(&string[0..string.len()]);
|
||||
murmur3_x86_128(&mut tmp, 0)
|
||||
});
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn bench_c_x86_128(b: &mut Bencher) {
|
||||
let string: &[u8] =
|
||||
test::black_box(b"Lorem ipsum dolor sit amet, consectetur adipisicing elit");
|
||||
b.bytes = string.len() as u64;
|
||||
b.iter(|| {
|
||||
let output: [u8; 16] = [0; 16];
|
||||
unsafe {
|
||||
murmur3_sys::MurmurHash3_x86_128(
|
||||
string.as_ptr() as _,
|
||||
string.len() as i32,
|
||||
0,
|
||||
output.as_ptr() as *mut _,
|
||||
);
|
||||
}
|
||||
output[0]
|
||||
});
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn bench_x64_128(b: &mut Bencher) {
|
||||
let string: &[u8] =
|
||||
test::black_box(b"Lorem ipsum dolor sit amet, consectetur adipisicing elit");
|
||||
b.bytes = string.len() as u64;
|
||||
b.iter(|| {
|
||||
let mut tmp = Cursor::new(&string[0..string.len()]);
|
||||
murmur3_x64_128(&mut tmp, 0)
|
||||
});
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn bench_c_x64_128(b: &mut Bencher) {
|
||||
let string: &[u8] =
|
||||
test::black_box(b"Lorem ipsum dolor sit amet, consectetur adipisicing elit");
|
||||
b.bytes = string.len() as u64;
|
||||
b.iter(|| {
|
||||
let output: [u8; 16] = [0; 16];
|
||||
unsafe {
|
||||
murmur3_sys::MurmurHash3_x64_128(
|
||||
string.as_ptr() as _,
|
||||
string.len() as i32,
|
||||
0,
|
||||
output.as_ptr() as *mut _,
|
||||
);
|
||||
}
|
||||
output[0]
|
||||
});
|
||||
}
|
2
rust/murmur3/murmur3-sys/.gitignore
vendored
Normal file
2
rust/murmur3/murmur3-sys/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
/target
|
||||
**/*.rs.bk
|
9
rust/murmur3/murmur3-sys/Cargo.toml
Normal file
9
rust/murmur3/murmur3-sys/Cargo.toml
Normal file
@ -0,0 +1,9 @@
|
||||
[package]
|
||||
name = "murmur3-sys"
|
||||
version = "0.1.0"
|
||||
authors = ["Stu Small <stuart.small@threat-x.com>"]
|
||||
|
||||
[dependencies]
|
||||
|
||||
[build-dependencies]
|
||||
bindgen = "0.69.1"
|
28
rust/murmur3/murmur3-sys/build.rs
Normal file
28
rust/murmur3/murmur3-sys/build.rs
Normal file
@ -0,0 +1,28 @@
|
||||
extern crate bindgen;
|
||||
|
||||
use std::env;
|
||||
use std::path::PathBuf;
|
||||
use std::process::Command;
|
||||
|
||||
fn main() {
|
||||
let out_dir = env::var("OUT_DIR").expect("No out dir");
|
||||
println!("cargo:rustc-link-lib=murmur3");
|
||||
println!("cargo:rustc-link-search=native={}", &out_dir);
|
||||
|
||||
let bindings = bindgen::Builder::default()
|
||||
.header("murmur3.h")
|
||||
.generate()
|
||||
.expect("Unable to generate bindings");
|
||||
|
||||
assert!(Command::new("make")
|
||||
.arg("shared")
|
||||
.status()
|
||||
.expect("Building C lib failed")
|
||||
.success());
|
||||
|
||||
// Write the bindings to the $OUT_DIR/bindings.rs file.
|
||||
let out_path = PathBuf::from(out_dir);
|
||||
bindings
|
||||
.write_to_file(out_path.join("bindings.rs"))
|
||||
.expect("Couldn't write bindings!");
|
||||
}
|
10
rust/murmur3/murmur3-sys/makefile
Normal file
10
rust/murmur3/murmur3-sys/makefile
Normal file
@ -0,0 +1,10 @@
|
||||
CFLAGS = -O3 -Wall
|
||||
|
||||
.PHONY: all clean tests
|
||||
|
||||
shared: murmur3.c murmur3.h
|
||||
$(CC) -fPIC -O3 -c murmur3.c -o $(OUT_DIR)/murmur3.o
|
||||
$(CC) -shared -Wl,--export-dynamic $(OUT_DIR)/murmur3.o -o $(OUT_DIR)/libmurmur3.so
|
||||
|
||||
clean:
|
||||
rm -rf *.o *.so
|
315
rust/murmur3/murmur3-sys/murmur3.c
Normal file
315
rust/murmur3/murmur3-sys/murmur3.c
Normal file
@ -0,0 +1,315 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// MurmurHash3 was written by Austin Appleby, and is placed in the public
|
||||
// domain. The author hereby disclaims copyright to this source code.
|
||||
|
||||
// Note - The x86 and x64 versions do _not_ produce the same results, as the
|
||||
// algorithms are optimized for their respective platforms. You can still
|
||||
// compile and run any of them on any platform, but your performance with the
|
||||
// non-native version will be less than optimal.
|
||||
|
||||
#include "murmur3.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Platform-specific functions and macros
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define FORCE_INLINE __attribute__((always_inline)) inline
|
||||
#else
|
||||
#define FORCE_INLINE inline
|
||||
#endif
|
||||
|
||||
static FORCE_INLINE uint32_t rotl32 ( uint32_t x, int8_t r )
|
||||
{
|
||||
return (x << r) | (x >> (32 - r));
|
||||
}
|
||||
|
||||
static FORCE_INLINE uint64_t rotl64 ( uint64_t x, int8_t r )
|
||||
{
|
||||
return (x << r) | (x >> (64 - r));
|
||||
}
|
||||
|
||||
#define ROTL32(x,y) rotl32(x,y)
|
||||
#define ROTL64(x,y) rotl64(x,y)
|
||||
|
||||
#define BIG_CONSTANT(x) (x##LLU)
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Block read - if your platform needs to do endian-swapping or can only
|
||||
// handle aligned reads, do the conversion here
|
||||
|
||||
#define getblock(p, i) (p[i])
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Finalization mix - force all bits of a hash block to avalanche
|
||||
|
||||
static FORCE_INLINE uint32_t fmix32 ( uint32_t h )
|
||||
{
|
||||
h ^= h >> 16;
|
||||
h *= 0x85ebca6b;
|
||||
h ^= h >> 13;
|
||||
h *= 0xc2b2ae35;
|
||||
h ^= h >> 16;
|
||||
|
||||
return h;
|
||||
}
|
||||
|
||||
//----------
|
||||
|
||||
static FORCE_INLINE uint64_t fmix64 ( uint64_t k )
|
||||
{
|
||||
k ^= k >> 33;
|
||||
k *= BIG_CONSTANT(0xff51afd7ed558ccd);
|
||||
k ^= k >> 33;
|
||||
k *= BIG_CONSTANT(0xc4ceb9fe1a85ec53);
|
||||
k ^= k >> 33;
|
||||
|
||||
return k;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void MurmurHash3_x86_32 ( const void * key, int len,
|
||||
uint32_t seed, void * out )
|
||||
{
|
||||
const uint8_t * data = (const uint8_t*)key;
|
||||
const int nblocks = len / 4;
|
||||
int i;
|
||||
|
||||
uint32_t h1 = seed;
|
||||
|
||||
uint32_t c1 = 0xcc9e2d51;
|
||||
uint32_t c2 = 0x1b873593;
|
||||
|
||||
//----------
|
||||
// body
|
||||
|
||||
const uint32_t * blocks = (const uint32_t *)(data + nblocks*4);
|
||||
|
||||
for(i = -nblocks; i; i++)
|
||||
{
|
||||
uint32_t k1 = getblock(blocks,i);
|
||||
|
||||
k1 *= c1;
|
||||
k1 = ROTL32(k1,15);
|
||||
k1 *= c2;
|
||||
|
||||
h1 ^= k1;
|
||||
h1 = ROTL32(h1,13);
|
||||
h1 = h1*5+0xe6546b64;
|
||||
}
|
||||
|
||||
//----------
|
||||
// tail
|
||||
|
||||
const uint8_t * tail = (const uint8_t*)(data + nblocks*4);
|
||||
|
||||
uint32_t k1 = 0;
|
||||
|
||||
switch(len & 3)
|
||||
{
|
||||
case 3: k1 ^= tail[2] << 16;
|
||||
case 2: k1 ^= tail[1] << 8;
|
||||
case 1: k1 ^= tail[0];
|
||||
k1 *= c1; k1 = ROTL32(k1,15); k1 *= c2; h1 ^= k1;
|
||||
};
|
||||
|
||||
//----------
|
||||
// finalization
|
||||
|
||||
h1 ^= len;
|
||||
|
||||
h1 = fmix32(h1);
|
||||
|
||||
*(uint32_t*)out = h1;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void MurmurHash3_x86_128 ( const void * key, const int len,
|
||||
uint32_t seed, void * out )
|
||||
{
|
||||
const uint8_t * data = (const uint8_t*)key;
|
||||
const int nblocks = len / 16;
|
||||
int i;
|
||||
|
||||
uint32_t h1 = seed;
|
||||
uint32_t h2 = seed;
|
||||
uint32_t h3 = seed;
|
||||
uint32_t h4 = seed;
|
||||
|
||||
uint32_t c1 = 0x239b961b;
|
||||
uint32_t c2 = 0xab0e9789;
|
||||
uint32_t c3 = 0x38b34ae5;
|
||||
uint32_t c4 = 0xa1e38b93;
|
||||
|
||||
//----------
|
||||
// body
|
||||
|
||||
const uint32_t * blocks = (const uint32_t *)(data + nblocks*16);
|
||||
|
||||
for(i = -nblocks; i; i++)
|
||||
{
|
||||
uint32_t k1 = getblock(blocks,i*4+0);
|
||||
uint32_t k2 = getblock(blocks,i*4+1);
|
||||
uint32_t k3 = getblock(blocks,i*4+2);
|
||||
uint32_t k4 = getblock(blocks,i*4+3);
|
||||
|
||||
k1 *= c1; k1 = ROTL32(k1,15); k1 *= c2; h1 ^= k1;
|
||||
|
||||
h1 = ROTL32(h1,19); h1 += h2; h1 = h1*5+0x561ccd1b;
|
||||
|
||||
k2 *= c2; k2 = ROTL32(k2,16); k2 *= c3; h2 ^= k2;
|
||||
|
||||
h2 = ROTL32(h2,17); h2 += h3; h2 = h2*5+0x0bcaa747;
|
||||
|
||||
k3 *= c3; k3 = ROTL32(k3,17); k3 *= c4; h3 ^= k3;
|
||||
|
||||
h3 = ROTL32(h3,15); h3 += h4; h3 = h3*5+0x96cd1c35;
|
||||
|
||||
k4 *= c4; k4 = ROTL32(k4,18); k4 *= c1; h4 ^= k4;
|
||||
|
||||
h4 = ROTL32(h4,13); h4 += h1; h4 = h4*5+0x32ac3b17;
|
||||
}
|
||||
|
||||
//----------
|
||||
// tail
|
||||
|
||||
const uint8_t * tail = (const uint8_t*)(data + nblocks*16);
|
||||
|
||||
uint32_t k1 = 0;
|
||||
uint32_t k2 = 0;
|
||||
uint32_t k3 = 0;
|
||||
uint32_t k4 = 0;
|
||||
|
||||
switch(len & 15)
|
||||
{
|
||||
case 15: k4 ^= tail[14] << 16;
|
||||
case 14: k4 ^= tail[13] << 8;
|
||||
case 13: k4 ^= tail[12] << 0;
|
||||
k4 *= c4; k4 = ROTL32(k4,18); k4 *= c1; h4 ^= k4;
|
||||
|
||||
case 12: k3 ^= tail[11] << 24;
|
||||
case 11: k3 ^= tail[10] << 16;
|
||||
case 10: k3 ^= tail[ 9] << 8;
|
||||
case 9: k3 ^= tail[ 8] << 0;
|
||||
k3 *= c3; k3 = ROTL32(k3,17); k3 *= c4; h3 ^= k3;
|
||||
|
||||
case 8: k2 ^= tail[ 7] << 24;
|
||||
case 7: k2 ^= tail[ 6] << 16;
|
||||
case 6: k2 ^= tail[ 5] << 8;
|
||||
case 5: k2 ^= tail[ 4] << 0;
|
||||
k2 *= c2; k2 = ROTL32(k2,16); k2 *= c3; h2 ^= k2;
|
||||
|
||||
case 4: k1 ^= tail[ 3] << 24;
|
||||
case 3: k1 ^= tail[ 2] << 16;
|
||||
case 2: k1 ^= tail[ 1] << 8;
|
||||
case 1: k1 ^= tail[ 0] << 0;
|
||||
k1 *= c1; k1 = ROTL32(k1,15); k1 *= c2; h1 ^= k1;
|
||||
};
|
||||
|
||||
//----------
|
||||
// finalization
|
||||
|
||||
h1 ^= len; h2 ^= len; h3 ^= len; h4 ^= len;
|
||||
|
||||
h1 += h2; h1 += h3; h1 += h4;
|
||||
h2 += h1; h3 += h1; h4 += h1;
|
||||
|
||||
h1 = fmix32(h1);
|
||||
h2 = fmix32(h2);
|
||||
h3 = fmix32(h3);
|
||||
h4 = fmix32(h4);
|
||||
|
||||
h1 += h2; h1 += h3; h1 += h4;
|
||||
h2 += h1; h3 += h1; h4 += h1;
|
||||
|
||||
((uint32_t*)out)[0] = h1;
|
||||
((uint32_t*)out)[1] = h2;
|
||||
((uint32_t*)out)[2] = h3;
|
||||
((uint32_t*)out)[3] = h4;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void MurmurHash3_x64_128 ( const void * key, const int len,
|
||||
const uint32_t seed, void * out )
|
||||
{
|
||||
const uint8_t * data = (const uint8_t*)key;
|
||||
const int nblocks = len / 16;
|
||||
int i;
|
||||
|
||||
uint64_t h1 = seed;
|
||||
uint64_t h2 = seed;
|
||||
|
||||
uint64_t c1 = BIG_CONSTANT(0x87c37b91114253d5);
|
||||
uint64_t c2 = BIG_CONSTANT(0x4cf5ad432745937f);
|
||||
|
||||
//----------
|
||||
// body
|
||||
|
||||
const uint64_t * blocks = (const uint64_t *)(data);
|
||||
|
||||
for(i = 0; i < nblocks; i++)
|
||||
{
|
||||
uint64_t k1 = getblock(blocks,i*2+0);
|
||||
uint64_t k2 = getblock(blocks,i*2+1);
|
||||
|
||||
k1 *= c1; k1 = ROTL64(k1,31); k1 *= c2; h1 ^= k1;
|
||||
|
||||
h1 = ROTL64(h1,27); h1 += h2; h1 = h1*5+0x52dce729;
|
||||
|
||||
k2 *= c2; k2 = ROTL64(k2,33); k2 *= c1; h2 ^= k2;
|
||||
|
||||
h2 = ROTL64(h2,31); h2 += h1; h2 = h2*5+0x38495ab5;
|
||||
}
|
||||
|
||||
//----------
|
||||
// tail
|
||||
|
||||
const uint8_t * tail = (const uint8_t*)(data + nblocks*16);
|
||||
|
||||
uint64_t k1 = 0;
|
||||
uint64_t k2 = 0;
|
||||
|
||||
switch(len & 15)
|
||||
{
|
||||
case 15: k2 ^= (uint64_t)(tail[14]) << 48;
|
||||
case 14: k2 ^= (uint64_t)(tail[13]) << 40;
|
||||
case 13: k2 ^= (uint64_t)(tail[12]) << 32;
|
||||
case 12: k2 ^= (uint64_t)(tail[11]) << 24;
|
||||
case 11: k2 ^= (uint64_t)(tail[10]) << 16;
|
||||
case 10: k2 ^= (uint64_t)(tail[ 9]) << 8;
|
||||
case 9: k2 ^= (uint64_t)(tail[ 8]) << 0;
|
||||
k2 *= c2; k2 = ROTL64(k2,33); k2 *= c1; h2 ^= k2;
|
||||
|
||||
case 8: k1 ^= (uint64_t)(tail[ 7]) << 56;
|
||||
case 7: k1 ^= (uint64_t)(tail[ 6]) << 48;
|
||||
case 6: k1 ^= (uint64_t)(tail[ 5]) << 40;
|
||||
case 5: k1 ^= (uint64_t)(tail[ 4]) << 32;
|
||||
case 4: k1 ^= (uint64_t)(tail[ 3]) << 24;
|
||||
case 3: k1 ^= (uint64_t)(tail[ 2]) << 16;
|
||||
case 2: k1 ^= (uint64_t)(tail[ 1]) << 8;
|
||||
case 1: k1 ^= (uint64_t)(tail[ 0]) << 0;
|
||||
k1 *= c1; k1 = ROTL64(k1,31); k1 *= c2; h1 ^= k1;
|
||||
};
|
||||
|
||||
//----------
|
||||
// finalization
|
||||
|
||||
h1 ^= len; h2 ^= len;
|
||||
|
||||
h1 += h2;
|
||||
h2 += h1;
|
||||
|
||||
h1 = fmix64(h1);
|
||||
h2 = fmix64(h2);
|
||||
|
||||
h1 += h2;
|
||||
h2 += h1;
|
||||
|
||||
((uint64_t*)out)[0] = h1;
|
||||
((uint64_t*)out)[1] = h2;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
29
rust/murmur3/murmur3-sys/murmur3.h
Normal file
29
rust/murmur3/murmur3-sys/murmur3.h
Normal file
@ -0,0 +1,29 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// MurmurHash3 was written by Austin Appleby, and is placed in the
|
||||
// public domain. The author hereby disclaims copyright to this source
|
||||
// code.
|
||||
|
||||
#ifndef _MURMURHASH3_H_
|
||||
#define _MURMURHASH3_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void MurmurHash3_x86_32 (const void *key, int len, uint32_t seed, void *out);
|
||||
|
||||
void MurmurHash3_x86_128(const void *key, int len, uint32_t seed, void *out);
|
||||
|
||||
void MurmurHash3_x64_128(const void *key, int len, uint32_t seed, void *out);
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // _MURMURHASH3_H_
|
24
rust/murmur3/murmur3-sys/src/lib.rs
Normal file
24
rust/murmur3/murmur3-sys/src/lib.rs
Normal file
@ -0,0 +1,24 @@
|
||||
#![allow(non_upper_case_globals)]
|
||||
#![allow(non_camel_case_types)]
|
||||
#![allow(non_snake_case)]
|
||||
|
||||
include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
|
||||
use super::*;
|
||||
#[test]
|
||||
fn simple_test() {
|
||||
unsafe {
|
||||
let test = "hello".as_bytes();
|
||||
let output: [u8; 16] = [0; 16];
|
||||
MurmurHash3_x64_128(
|
||||
test.as_ptr() as _,
|
||||
test.len() as i32,
|
||||
0,
|
||||
output.as_ptr() as *mut _,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
58
rust/murmur3/src/lib.rs
Normal file
58
rust/murmur3/src/lib.rs
Normal file
@ -0,0 +1,58 @@
|
||||
// Copyright (c) 2020 Stu Small
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0
|
||||
// <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0> or the MIT
|
||||
// license <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. All files in the project carrying such notice may not be copied,
|
||||
// modified, or distributed except according to those terms.
|
||||
|
||||
//! A pure rust implementation of the fast, non-cryptographic hash [murmur3](https://en.wikipedia.org/wiki/MurmurHash)
|
||||
#![deny(missing_docs)]
|
||||
|
||||
mod murmur3_32;
|
||||
mod murmur3_x64_128;
|
||||
mod murmur3_x86_128;
|
||||
|
||||
use std::io::{ErrorKind, Read, Result};
|
||||
|
||||
pub use self::murmur3_32::*;
|
||||
pub use self::murmur3_x64_128::*;
|
||||
pub use self::murmur3_x86_128::*;
|
||||
|
||||
fn copy_into_array<A, T>(slice: &[T]) -> A
|
||||
where
|
||||
A: Default + AsMut<[T]>,
|
||||
T: Copy,
|
||||
{
|
||||
let mut a = A::default();
|
||||
<A as AsMut<[T]>>::as_mut(&mut a).copy_from_slice(slice);
|
||||
a
|
||||
}
|
||||
|
||||
/// Try to fill buf with data from source, dealing with short reads such as
|
||||
/// caused by Chain.
|
||||
///
|
||||
/// Errors: See `std::io::Read`.
|
||||
fn read_bytes<R>(source: &mut R, buf: &mut [u8]) -> Result<usize>
|
||||
where
|
||||
R: Read,
|
||||
{
|
||||
let mut offset = 0;
|
||||
loop {
|
||||
match source.read(&mut buf[offset..]) {
|
||||
Ok(0) => {
|
||||
return Ok(offset);
|
||||
}
|
||||
Ok(n) => {
|
||||
offset += n;
|
||||
if offset == buf.len() {
|
||||
return Ok(offset);
|
||||
}
|
||||
}
|
||||
Err(ref e) if e.kind() == ErrorKind::Interrupted => {}
|
||||
Err(e) => {
|
||||
return Err(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
130
rust/murmur3/src/murmur3_32.rs
Normal file
130
rust/murmur3/src/murmur3_32.rs
Normal file
@ -0,0 +1,130 @@
|
||||
// Copyright (c) 2020 Stu Small
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0
|
||||
// <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0> or the MIT
|
||||
// license <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. All files in the project carrying such notice may not be copied,
|
||||
// modified, or distributed except according to those terms.
|
||||
|
||||
use std::cmp::min;
|
||||
use std::io::{Read, Result};
|
||||
|
||||
use crate::read_bytes;
|
||||
|
||||
const C1: u32 = 0x85eb_ca6b;
|
||||
const C2: u32 = 0xc2b2_ae35;
|
||||
const R1: u32 = 16;
|
||||
const R2: u32 = 13;
|
||||
const M: u32 = 5;
|
||||
const N: u32 = 0xe654_6b64;
|
||||
|
||||
/// Use the 32 bit variant of murmur3 to hash some [Read] implementation.
|
||||
///
|
||||
/// # Example
|
||||
/// ```
|
||||
/// use std::io::Cursor;
|
||||
/// use murmur3::murmur3_32;
|
||||
/// let hash_result = murmur3_32(&mut Cursor::new("hello world"), 0);
|
||||
/// ```
|
||||
pub fn murmur3_32<T: Read>(source: &mut T, seed: u32) -> Result<u32> {
|
||||
let mut buffer: [u8; 4] = [0; 4];
|
||||
let mut processed = 0;
|
||||
let mut state = seed;
|
||||
loop {
|
||||
match read_bytes(source, &mut buffer)? {
|
||||
4 => {
|
||||
processed += 4;
|
||||
let k = u32::from_le_bytes(buffer);
|
||||
state ^= calc_k(k);
|
||||
state = state.rotate_left(R2);
|
||||
state = (state.wrapping_mul(M)).wrapping_add(N);
|
||||
}
|
||||
3 => {
|
||||
processed += 3;
|
||||
let k: u32 =
|
||||
((buffer[2] as u32) << 16) | ((buffer[1] as u32) << 8) | (buffer[0] as u32);
|
||||
state ^= calc_k(k);
|
||||
}
|
||||
2 => {
|
||||
processed += 2;
|
||||
let k: u32 = ((buffer[1] as u32) << 8) | (buffer[0] as u32);
|
||||
state ^= calc_k(k);
|
||||
}
|
||||
1 => {
|
||||
processed += 1;
|
||||
let k: u32 = buffer[0] as u32;
|
||||
state ^= calc_k(k);
|
||||
}
|
||||
0 => return Ok(finish(state, processed)),
|
||||
_ => panic!("Internal buffer state failure"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Use the 32 bit variant of murmur3 to hash [u8] without copying the buffer.
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
/// ```
|
||||
/// use murmur3::murmur3_32_of_slice;
|
||||
/// let hash_result = murmur3_32_of_slice("hello world".as_bytes(), 0);
|
||||
/// ```
|
||||
pub fn murmur3_32_of_slice(source: &[u8], seed: u32) -> u32 {
|
||||
let mut buffer = source;
|
||||
let mut processed = 0;
|
||||
let mut state = seed;
|
||||
loop {
|
||||
match min(buffer.len(), 4) {
|
||||
0 => return finish(state, processed),
|
||||
1 => {
|
||||
processed += 1;
|
||||
let k: u32 = buffer[0] as u32;
|
||||
state ^= calc_k(k);
|
||||
return finish(state, processed);
|
||||
}
|
||||
2 => {
|
||||
processed += 2;
|
||||
let k: u32 = ((buffer[1] as u32) << 8) | (buffer[0] as u32);
|
||||
state ^= calc_k(k);
|
||||
return finish(state, processed);
|
||||
}
|
||||
3 => {
|
||||
processed += 3;
|
||||
let k: u32 =
|
||||
((buffer[2] as u32) << 16) | ((buffer[1] as u32) << 8) | (buffer[0] as u32);
|
||||
state ^= calc_k(k);
|
||||
return finish(state, processed);
|
||||
}
|
||||
4 => {
|
||||
processed += 4;
|
||||
let k: u32 = ((buffer[3] as u32) << 24)
|
||||
| ((buffer[2] as u32) << 16)
|
||||
| ((buffer[1] as u32) << 8)
|
||||
| (buffer[0] as u32);
|
||||
state ^= calc_k(k);
|
||||
state = state.rotate_left(R2);
|
||||
state = (state.wrapping_mul(M)).wrapping_add(N);
|
||||
buffer = &buffer[4..];
|
||||
}
|
||||
_ => unreachable!(),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
fn finish(state: u32, processed: u32) -> u32 {
|
||||
let mut hash = state;
|
||||
hash ^= processed;
|
||||
hash ^= hash.wrapping_shr(R1);
|
||||
hash = hash.wrapping_mul(C1);
|
||||
hash ^= hash.wrapping_shr(R2);
|
||||
hash = hash.wrapping_mul(C2);
|
||||
hash ^= hash.wrapping_shr(R1);
|
||||
hash
|
||||
}
|
||||
|
||||
fn calc_k(k: u32) -> u32 {
|
||||
const C1: u32 = 0xcc9e_2d51;
|
||||
const C2: u32 = 0x1b87_3593;
|
||||
const R1: u32 = 15;
|
||||
k.wrapping_mul(C1).rotate_left(R1).wrapping_mul(C2)
|
||||
}
|
133
rust/murmur3/src/murmur3_x64_128.rs
Normal file
133
rust/murmur3/src/murmur3_x64_128.rs
Normal file
@ -0,0 +1,133 @@
|
||||
// Copyright (c) 2020 Stu Small
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0
|
||||
// <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0> or the MIT
|
||||
// license <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. All files in the project carrying such notice may not be copied,
|
||||
// modified, or distributed except according to those terms.
|
||||
|
||||
use std::io::{Read, Result};
|
||||
use std::ops::Shl;
|
||||
|
||||
use crate::{copy_into_array, read_bytes};
|
||||
|
||||
/// Use the x64 variant of the 128 bit murmur3 to hash some [Read] implementation.
|
||||
///
|
||||
/// # Example
|
||||
/// ```
|
||||
/// use std::io::Cursor;
|
||||
/// use murmur3::murmur3_x64_128;
|
||||
/// let hash_result = murmur3_x64_128(&mut Cursor::new("hello world"), 0);
|
||||
/// ```
|
||||
pub fn murmur3_x64_128<T: Read>(source: &mut T, seed: u32) -> Result<u128> {
|
||||
const C1: u64 = 0x87c3_7b91_1142_53d5;
|
||||
const C2: u64 = 0x4cf5_ad43_2745_937f;
|
||||
const C3: u64 = 0x52dc_e729;
|
||||
const C4: u64 = 0x3849_5ab5;
|
||||
const R1: u32 = 27;
|
||||
const R2: u32 = 31;
|
||||
const R3: u32 = 33;
|
||||
const M: u64 = 5;
|
||||
let mut h1: u64 = seed as u64;
|
||||
let mut h2: u64 = seed as u64;
|
||||
let mut buf = [0; 16];
|
||||
let mut processed: usize = 0;
|
||||
loop {
|
||||
let read = read_bytes(source, &mut buf[..])?;
|
||||
processed += read;
|
||||
if read == 16 {
|
||||
let k1 = u64::from_le_bytes(copy_into_array(&buf[0..8]));
|
||||
let k2 = u64::from_le_bytes(copy_into_array(&buf[8..]));
|
||||
h1 ^= k1.wrapping_mul(C1).rotate_left(R2).wrapping_mul(C2);
|
||||
h1 = h1
|
||||
.rotate_left(R1)
|
||||
.wrapping_add(h2)
|
||||
.wrapping_mul(M)
|
||||
.wrapping_add(C3);
|
||||
h2 ^= k2.wrapping_mul(C2).rotate_left(R3).wrapping_mul(C1);
|
||||
h2 = h2
|
||||
.rotate_left(R2)
|
||||
.wrapping_add(h1)
|
||||
.wrapping_mul(M)
|
||||
.wrapping_add(C4);
|
||||
} else if read == 0 {
|
||||
h1 ^= processed as u64;
|
||||
h2 ^= processed as u64;
|
||||
h1 = h1.wrapping_add(h2);
|
||||
h2 = h2.wrapping_add(h1);
|
||||
h1 = fmix64(h1);
|
||||
h2 = fmix64(h2);
|
||||
h1 = h1.wrapping_add(h2);
|
||||
h2 = h2.wrapping_add(h1);
|
||||
let x = ((h2 as u128) << 64) | (h1 as u128);
|
||||
return Ok(x);
|
||||
} else {
|
||||
let mut k1 = 0;
|
||||
let mut k2 = 0;
|
||||
if read >= 15 {
|
||||
k2 ^= (buf[14] as u64).shl(48);
|
||||
}
|
||||
if read >= 14 {
|
||||
k2 ^= (buf[13] as u64).shl(40);
|
||||
}
|
||||
if read >= 13 {
|
||||
k2 ^= (buf[12] as u64).shl(32);
|
||||
}
|
||||
if read >= 12 {
|
||||
k2 ^= (buf[11] as u64).shl(24);
|
||||
}
|
||||
if read >= 11 {
|
||||
k2 ^= (buf[10] as u64).shl(16);
|
||||
}
|
||||
if read >= 10 {
|
||||
k2 ^= (buf[9] as u64).shl(8);
|
||||
}
|
||||
if read >= 9 {
|
||||
k2 ^= buf[8] as u64;
|
||||
k2 = k2.wrapping_mul(C2).rotate_left(33).wrapping_mul(C1);
|
||||
h2 ^= k2;
|
||||
}
|
||||
if read >= 8 {
|
||||
k1 ^= (buf[7] as u64).shl(56);
|
||||
}
|
||||
if read >= 7 {
|
||||
k1 ^= (buf[6] as u64).shl(48);
|
||||
}
|
||||
if read >= 6 {
|
||||
k1 ^= (buf[5] as u64).shl(40);
|
||||
}
|
||||
if read >= 5 {
|
||||
k1 ^= (buf[4] as u64).shl(32);
|
||||
}
|
||||
if read >= 4 {
|
||||
k1 ^= (buf[3] as u64).shl(24);
|
||||
}
|
||||
if read >= 3 {
|
||||
k1 ^= (buf[2] as u64).shl(16);
|
||||
}
|
||||
if read >= 2 {
|
||||
k1 ^= (buf[1] as u64).shl(8);
|
||||
}
|
||||
if read >= 1 {
|
||||
k1 ^= buf[0] as u64;
|
||||
}
|
||||
k1 = k1.wrapping_mul(C1);
|
||||
k1 = k1.rotate_left(31);
|
||||
k1 = k1.wrapping_mul(C2);
|
||||
h1 ^= k1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn fmix64(k: u64) -> u64 {
|
||||
const C1: u64 = 0xff51_afd7_ed55_8ccd;
|
||||
const C2: u64 = 0xc4ce_b9fe_1a85_ec53;
|
||||
const R: u32 = 33;
|
||||
let mut tmp = k;
|
||||
tmp ^= tmp >> R;
|
||||
tmp = tmp.wrapping_mul(C1);
|
||||
tmp ^= tmp >> R;
|
||||
tmp = tmp.wrapping_mul(C2);
|
||||
tmp ^= tmp >> R;
|
||||
tmp
|
||||
}
|
171
rust/murmur3/src/murmur3_x86_128.rs
Normal file
171
rust/murmur3/src/murmur3_x86_128.rs
Normal file
@ -0,0 +1,171 @@
|
||||
// Copyright (c) 2020 Stu Small
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0
|
||||
// <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0> or the MIT
|
||||
// license <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. All files in the project carrying such notice may not be copied,
|
||||
// modified, or distributed except according to those terms.
|
||||
|
||||
use std::io::{Read, Result};
|
||||
use std::ops::Shl;
|
||||
|
||||
use crate::{copy_into_array, read_bytes};
|
||||
|
||||
/// Use the x86 variant of the 128 bit murmur3 to hash some [Read] implementation.
|
||||
///
|
||||
/// # Example
|
||||
/// ```
|
||||
/// use std::io::Cursor;
|
||||
/// use murmur3::murmur3_x86_128;
|
||||
/// let hash_result = murmur3_x86_128(&mut Cursor::new("hello world"), 0);
|
||||
/// ```
|
||||
pub fn murmur3_x86_128<T: Read>(source: &mut T, seed: u32) -> Result<u128> {
|
||||
const C1: u32 = 0x239b_961b;
|
||||
const C2: u32 = 0xab0e_9789;
|
||||
const C3: u32 = 0x38b3_4ae5;
|
||||
const C4: u32 = 0xa1e3_8b93;
|
||||
const C5: u32 = 0x561c_cd1b;
|
||||
const C6: u32 = 0x0bca_a747;
|
||||
const C7: u32 = 0x96cd_1c35;
|
||||
const C8: u32 = 0x32ac_3b17;
|
||||
const M: u32 = 5;
|
||||
|
||||
let mut h1: u32 = seed;
|
||||
let mut h2: u32 = seed;
|
||||
let mut h3: u32 = seed;
|
||||
let mut h4: u32 = seed;
|
||||
|
||||
let mut buf = [0; 16];
|
||||
let mut processed: usize = 0;
|
||||
loop {
|
||||
let read = read_bytes(source, &mut buf[..])?;
|
||||
processed += read;
|
||||
if read == 16 {
|
||||
let k1 = u32::from_le_bytes(copy_into_array(&buf[0..4]));
|
||||
let k2 = u32::from_le_bytes(copy_into_array(&buf[4..8]));
|
||||
let k3 = u32::from_le_bytes(copy_into_array(&buf[8..12]));
|
||||
let k4 = u32::from_le_bytes(copy_into_array(&buf[12..16]));
|
||||
h1 ^= k1.wrapping_mul(C1).rotate_left(15).wrapping_mul(C2);
|
||||
h1 = h1
|
||||
.rotate_left(19)
|
||||
.wrapping_add(h2)
|
||||
.wrapping_mul(M)
|
||||
.wrapping_add(C5);
|
||||
h2 ^= k2.wrapping_mul(C2).rotate_left(16).wrapping_mul(C3);
|
||||
h2 = h2
|
||||
.rotate_left(17)
|
||||
.wrapping_add(h3)
|
||||
.wrapping_mul(M)
|
||||
.wrapping_add(C6);
|
||||
h3 ^= k3.wrapping_mul(C3).rotate_left(17).wrapping_mul(C4);
|
||||
h3 = h3
|
||||
.rotate_left(15)
|
||||
.wrapping_add(h4)
|
||||
.wrapping_mul(M)
|
||||
.wrapping_add(C7);
|
||||
h4 ^= k4.wrapping_mul(C4).rotate_left(18).wrapping_mul(C1);
|
||||
h4 = h4
|
||||
.rotate_left(13)
|
||||
.wrapping_add(h1)
|
||||
.wrapping_mul(M)
|
||||
.wrapping_add(C8);
|
||||
} else if read == 0 {
|
||||
h1 ^= processed as u32;
|
||||
h2 ^= processed as u32;
|
||||
h3 ^= processed as u32;
|
||||
h4 ^= processed as u32;
|
||||
h1 = h1.wrapping_add(h2);
|
||||
h1 = h1.wrapping_add(h3);
|
||||
h1 = h1.wrapping_add(h4);
|
||||
h2 = h2.wrapping_add(h1);
|
||||
h3 = h3.wrapping_add(h1);
|
||||
h4 = h4.wrapping_add(h1);
|
||||
h1 = fmix32(h1);
|
||||
h2 = fmix32(h2);
|
||||
h3 = fmix32(h3);
|
||||
h4 = fmix32(h4);
|
||||
h1 = h1.wrapping_add(h2);
|
||||
h1 = h1.wrapping_add(h3);
|
||||
h1 = h1.wrapping_add(h4);
|
||||
h2 = h2.wrapping_add(h1);
|
||||
h3 = h3.wrapping_add(h1);
|
||||
h4 = h4.wrapping_add(h1);
|
||||
let x = ((h4 as u128) << 96) | ((h3 as u128) << 64) | ((h2 as u128) << 32) | h1 as u128;
|
||||
return Ok(x);
|
||||
} else {
|
||||
let mut k1 = 0;
|
||||
let mut k2 = 0;
|
||||
let mut k3 = 0;
|
||||
let mut k4 = 0;
|
||||
if read >= 15 {
|
||||
k4 ^= (buf[14] as u32).shl(16);
|
||||
}
|
||||
if read >= 14 {
|
||||
k4 ^= (buf[13] as u32).shl(8);
|
||||
}
|
||||
if read >= 13 {
|
||||
k4 ^= buf[12] as u32;
|
||||
k4 = k4.wrapping_mul(C4).rotate_left(18).wrapping_mul(C1);
|
||||
h4 ^= k4;
|
||||
}
|
||||
if read >= 12 {
|
||||
k3 ^= (buf[11] as u32).shl(24);
|
||||
}
|
||||
if read >= 11 {
|
||||
k3 ^= (buf[10] as u32).shl(16);
|
||||
}
|
||||
if read >= 10 {
|
||||
k3 ^= (buf[9] as u32).shl(8);
|
||||
}
|
||||
if read >= 9 {
|
||||
k3 ^= buf[8] as u32;
|
||||
k3 = k3.wrapping_mul(C3).rotate_left(17).wrapping_mul(C4);
|
||||
h3 ^= k3;
|
||||
}
|
||||
if read >= 8 {
|
||||
k2 ^= (buf[7] as u32).shl(24);
|
||||
}
|
||||
if read >= 7 {
|
||||
k2 ^= (buf[6] as u32).shl(16);
|
||||
}
|
||||
if read >= 6 {
|
||||
k2 ^= (buf[5] as u32).shl(8);
|
||||
}
|
||||
if read >= 5 {
|
||||
k2 ^= buf[4] as u32;
|
||||
k2 = k2.wrapping_mul(C2).rotate_left(16).wrapping_mul(C3);
|
||||
h2 ^= k2;
|
||||
}
|
||||
if read >= 4 {
|
||||
k1 ^= (buf[3] as u32).shl(24);
|
||||
}
|
||||
if read >= 3 {
|
||||
k1 ^= (buf[2] as u32).shl(16);
|
||||
}
|
||||
if read >= 2 {
|
||||
k1 ^= (buf[1] as u32).shl(8);
|
||||
}
|
||||
if read >= 1 {
|
||||
k1 ^= buf[0] as u32;
|
||||
}
|
||||
k1 = k1.wrapping_mul(C1);
|
||||
k1 = k1.rotate_left(15);
|
||||
k1 = k1.wrapping_mul(C2);
|
||||
h1 ^= k1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn fmix32(k: u32) -> u32 {
|
||||
const C1: u32 = 0x85eb_ca6b;
|
||||
const C2: u32 = 0xc2b2_ae35;
|
||||
const R1: u32 = 16;
|
||||
const R2: u32 = 13;
|
||||
let mut tmp = k;
|
||||
tmp ^= tmp >> R1;
|
||||
tmp = tmp.wrapping_mul(C1);
|
||||
tmp ^= tmp >> R2;
|
||||
tmp = tmp.wrapping_mul(C2);
|
||||
tmp ^= tmp >> R1;
|
||||
tmp
|
||||
}
|
79
rust/murmur3/tests/quickcheck.rs
Normal file
79
rust/murmur3/tests/quickcheck.rs
Normal file
@ -0,0 +1,79 @@
|
||||
// Copyright (c) 2020 Stu Small
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0
|
||||
// <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0> or the MIT
|
||||
// license <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. All files in the project carrying such notice may not be copied,
|
||||
// modified, or distributed except according to those terms.
|
||||
|
||||
#[macro_use]
|
||||
extern crate quickcheck;
|
||||
extern crate murmur3;
|
||||
extern crate murmur3_sys;
|
||||
|
||||
use std::io::Cursor;
|
||||
|
||||
use murmur3::{murmur3_32, murmur3_32_of_slice};
|
||||
use murmur3_sys::MurmurHash3_x86_32;
|
||||
|
||||
use murmur3::murmur3_x86_128;
|
||||
use murmur3_sys::MurmurHash3_x86_128;
|
||||
|
||||
use murmur3::murmur3_x64_128;
|
||||
use murmur3_sys::MurmurHash3_x64_128;
|
||||
|
||||
quickcheck! {
|
||||
fn quickcheck_32(input:(u32, Vec<u8>)) -> bool{
|
||||
let seed = input.0;
|
||||
let xs = input.1;
|
||||
let output: [u8; 4] = [0; 4];
|
||||
unsafe {
|
||||
MurmurHash3_x86_32(xs.as_ptr() as _, xs.len() as i32,seed,output.as_ptr() as *mut _)
|
||||
};
|
||||
let output = u32::from_le_bytes(output);
|
||||
let output2 = murmur3_32(&mut Cursor::new(xs), seed).unwrap();
|
||||
output == output2
|
||||
}
|
||||
}
|
||||
|
||||
quickcheck! {
|
||||
fn quickcheck_32_slice(input:(u32, Vec<u8>)) -> bool{
|
||||
let seed = input.0;
|
||||
let xs = input.1;
|
||||
let mut output: [u8; 4] = [0; 4];
|
||||
unsafe {
|
||||
MurmurHash3_x86_32(xs.as_ptr() as _, xs.len() as i32, seed, output.as_mut_ptr() as _)
|
||||
};
|
||||
let output = u32::from_le_bytes(output);
|
||||
let output2 = murmur3_32_of_slice(&xs[..], seed);
|
||||
output == output2
|
||||
}
|
||||
}
|
||||
|
||||
quickcheck! {
|
||||
fn quickcheck_x86_128(input:(u32, Vec<u8>)) -> bool {
|
||||
let seed = input.0;
|
||||
let xs = input.1;
|
||||
let output_bytes: [u8; 16] = [0; 16];
|
||||
unsafe {
|
||||
MurmurHash3_x86_128(xs.as_ptr() as _, xs.len() as i32,seed,output_bytes.as_ptr() as *mut _)
|
||||
};
|
||||
let output = u128::from_le_bytes(output_bytes);
|
||||
let output2 = murmur3_x86_128(&mut Cursor::new(xs), seed).unwrap();
|
||||
output == output2
|
||||
}
|
||||
}
|
||||
|
||||
quickcheck! {
|
||||
fn quickcheck_x64_128(input:(u32, Vec<u8>)) -> bool {
|
||||
let seed = input.0;
|
||||
let xs = input.1;
|
||||
let output_bytes: [u8; 16] = [0; 16];
|
||||
unsafe {
|
||||
MurmurHash3_x64_128(xs.as_ptr() as _, xs.len() as i32,seed, output_bytes.as_ptr() as *mut _)
|
||||
};
|
||||
let output = u128::from_le_bytes(output_bytes);
|
||||
let output2 = murmur3_x64_128(&mut Cursor::new(xs), seed).unwrap();
|
||||
output == output2
|
||||
}
|
||||
}
|
412
rust/murmur3/tests/test.rs
Normal file
412
rust/murmur3/tests/test.rs
Normal file
@ -0,0 +1,412 @@
|
||||
// Copyright (c) 2020 Stu Small
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0
|
||||
// <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0> or the MIT
|
||||
// license <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. All files in the project carrying such notice may not be copied,
|
||||
// modified, or distributed except according to those terms.
|
||||
|
||||
extern crate murmur3;
|
||||
|
||||
use std::io::{Cursor, Read};
|
||||
|
||||
struct Result {
|
||||
string: &'static str,
|
||||
hash_32: u32,
|
||||
hash_128_x86: [u8; 16],
|
||||
hash_128_x64: [u8; 16],
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_static_strings() {
|
||||
let tests = [
|
||||
Result {
|
||||
string: "Lorem ipsum dolor sit amet, consectetur adipisicing \
|
||||
elit",
|
||||
hash_32: 0x3bf7e870,
|
||||
hash_128_x86: [
|
||||
0xAB, 0x53, 0x3F, 0x57, 0xAD, 0x3B, 0xBA, 0x56, 0xFE, 0xA4, 0x9F, 0x73, 0x48, 0x88,
|
||||
0x91, 0x10,
|
||||
],
|
||||
hash_128_x64: [
|
||||
0x6F, 0x5C, 0xB0, 0x2C, 0xFD, 0x5E, 0xDC, 0x6F, 0xE6, 0x9D, 0xF0, 0xFF, 0x60, 0x41,
|
||||
0x70, 0x46,
|
||||
],
|
||||
},
|
||||
Result {
|
||||
string: "Hello, world!",
|
||||
hash_32: 0xc0363e43,
|
||||
hash_128_x86: [
|
||||
0xA7, 0xDB, 0xAC, 0x26, 0xFC, 0x8D, 0x63, 0xF0, 0x63, 0x42, 0x2B, 0x40, 0xC3, 0xD4,
|
||||
0xFD, 0x0A,
|
||||
],
|
||||
hash_128_x64: [
|
||||
0xDF, 0x65, 0xD6, 0xD2, 0xD1, 0x2D, 0x51, 0xF1, 0x64, 0xC5, 0xF3, 0xA8, 0x50, 0x66,
|
||||
0x32, 0x2C,
|
||||
],
|
||||
},
|
||||
Result {
|
||||
string: "",
|
||||
hash_32: 0000000000,
|
||||
hash_128_x86: [
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00,
|
||||
],
|
||||
hash_128_x64: [
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00,
|
||||
],
|
||||
},
|
||||
Result {
|
||||
string: "1",
|
||||
hash_32: 0x9416ac93,
|
||||
hash_128_x86: [
|
||||
0xFB, 0xF4, 0xF2, 0xE0, 0xD5, 0xB1, 0x6B, 0xD9, 0xD5, 0xB1, 0x6B, 0xD9, 0xD5, 0xB1,
|
||||
0x6B, 0xD9,
|
||||
],
|
||||
hash_128_x64: [
|
||||
0x71, 0x7C, 0x7B, 0x8A, 0xFE, 0xBB, 0xFB, 0x71, 0x37, 0xF6, 0xF0, 0xF9, 0x9B, 0xEB,
|
||||
0x2A, 0x94,
|
||||
],
|
||||
},
|
||||
Result {
|
||||
string: "12",
|
||||
hash_32: 0xf9d2ef15,
|
||||
hash_128_x86: [
|
||||
0x9F, 0x1F, 0x9B, 0xC0, 0x1E, 0x49, 0x4F, 0xAF, 0x1E, 0x49, 0x4F, 0xAF, 0x1E, 0x49,
|
||||
0x4F, 0xAF,
|
||||
],
|
||||
hash_128_x64: [
|
||||
0x95, 0xFD, 0xE3, 0x09, 0x62, 0x3C, 0x53, 0x4A, 0x1D, 0x31, 0x0B, 0x5E, 0x69, 0x2C,
|
||||
0xC7, 0x88,
|
||||
],
|
||||
},
|
||||
Result {
|
||||
string: "123",
|
||||
hash_32: 0x9eb471eb,
|
||||
hash_128_x86: [
|
||||
0x2F, 0x2B, 0x4D, 0x51, 0x08, 0x6F, 0x40, 0x7B, 0x08, 0x6F, 0x40, 0x7B, 0x08, 0x6F,
|
||||
0x40, 0x7B,
|
||||
],
|
||||
hash_128_x64: [
|
||||
0x6A, 0x7F, 0x66, 0x0D, 0x1B, 0x2D, 0x5B, 0x98, 0x69, 0xCF, 0x0E, 0xCE, 0xE3, 0xA1,
|
||||
0x7E, 0x42,
|
||||
],
|
||||
},
|
||||
Result {
|
||||
string: "1234",
|
||||
hash_32: 0x721c5dc3,
|
||||
hash_128_x86: [
|
||||
0x4D, 0x64, 0xDF, 0x4A, 0xCE, 0x32, 0xAA, 0x2E, 0xCE, 0x32, 0xAA, 0x2E, 0xCE, 0x32,
|
||||
0xAA, 0x2E,
|
||||
],
|
||||
hash_128_x64: [
|
||||
0xB4, 0xE7, 0x8F, 0x21, 0x4D, 0x36, 0x97, 0x08, 0xA5, 0xFD, 0x37, 0x24, 0xD9, 0x8B,
|
||||
0x1E, 0x34,
|
||||
],
|
||||
},
|
||||
Result {
|
||||
string: "12345",
|
||||
hash_32: 0x13a51193,
|
||||
hash_128_x86: [
|
||||
0x7C, 0xF8, 0x48, 0xD0, 0x30, 0xD9, 0x59, 0x0A, 0x94, 0xED, 0x4F, 0xD4, 0x94, 0xED,
|
||||
0x4F, 0xD4,
|
||||
],
|
||||
hash_128_x64: [
|
||||
0xCB, 0xDF, 0x21, 0x6B, 0x17, 0x3A, 0xF8, 0x20, 0xF4, 0xA9, 0x5C, 0x32, 0x41, 0x5C,
|
||||
0x3C, 0xF1,
|
||||
],
|
||||
},
|
||||
Result {
|
||||
string: "123456",
|
||||
hash_32: 0xbf60eab8,
|
||||
hash_128_x86: [
|
||||
0xB9, 0xF9, 0x06, 0x7D, 0xBF, 0x7E, 0xEB, 0x69, 0xED, 0xEF, 0x32, 0x88, 0xED, 0xEF,
|
||||
0x32, 0x88,
|
||||
],
|
||||
hash_128_x64: [
|
||||
0xD6, 0xD0, 0xBB, 0x0B, 0x05, 0xCF, 0x17, 0xE4, 0xFE, 0x31, 0x25, 0x00, 0x91, 0x80,
|
||||
0xA4, 0x51,
|
||||
],
|
||||
},
|
||||
Result {
|
||||
string: "1234567",
|
||||
hash_32: 0xb7ef82f7,
|
||||
hash_128_x86: [
|
||||
0x71, 0xFE, 0x6B, 0x74, 0x54, 0x40, 0xC1, 0xEA, 0x92, 0xB3, 0x83, 0x8C, 0x92, 0xB3,
|
||||
0x83, 0x8C,
|
||||
],
|
||||
hash_128_x64: [
|
||||
0xA2, 0x23, 0xC6, 0xF2, 0xF7, 0xC5, 0xDA, 0x2C, 0x55, 0xD9, 0xE1, 0xCA, 0x8B, 0x51,
|
||||
0xDC, 0x37,
|
||||
],
|
||||
},
|
||||
Result {
|
||||
string: "12345678",
|
||||
hash_32: 0x91b313ce,
|
||||
hash_128_x86: [
|
||||
0x93, 0xD3, 0xAD, 0x65, 0x87, 0x73, 0x0B, 0x56, 0x3A, 0xEE, 0xC8, 0x6A, 0x3A, 0xEE,
|
||||
0xC8, 0x6A,
|
||||
],
|
||||
hash_128_x64: [
|
||||
0x9C, 0x41, 0xB1, 0x38, 0x06, 0x64, 0x4A, 0x3B, 0x57, 0x25, 0xD4, 0x6B, 0x67, 0x0E,
|
||||
0x3B, 0x91,
|
||||
],
|
||||
},
|
||||
Result {
|
||||
string: "123456789",
|
||||
hash_32: 0xb4fef382,
|
||||
hash_128_x86: [
|
||||
0xBB, 0x76, 0x58, 0xC6, 0x52, 0x15, 0x9A, 0x11, 0xD7, 0xE5, 0xE3, 0xC5, 0xA4, 0x8C,
|
||||
0x16, 0xA9,
|
||||
],
|
||||
hash_128_x64: [
|
||||
0xA4, 0xCC, 0x66, 0xDB, 0x5E, 0x64, 0x84, 0x3C, 0x05, 0xA1, 0x1E, 0x3A, 0xC7, 0xFA,
|
||||
0xF8, 0x99,
|
||||
],
|
||||
},
|
||||
Result {
|
||||
string: "1234567890",
|
||||
hash_32: 0x3204634d,
|
||||
hash_128_x86: [
|
||||
0x34, 0x0E, 0xAD, 0x47, 0x37, 0xA5, 0x10, 0x92, 0xAB, 0x4F, 0x1A, 0xE5, 0x40, 0xDA,
|
||||
0xE7, 0xAB,
|
||||
],
|
||||
hash_128_x64: [
|
||||
0x0A, 0x87, 0x79, 0x80, 0xE6, 0x4A, 0xFA, 0xEC, 0x2B, 0xD2, 0xEB, 0x20, 0xC8, 0x17,
|
||||
0xD0, 0xC1,
|
||||
],
|
||||
},
|
||||
Result {
|
||||
string: "12345678901",
|
||||
hash_32: 0x3ca173d0,
|
||||
hash_128_x86: [
|
||||
0xE7, 0xA8, 0xB1, 0x1F, 0x7D, 0x7F, 0xCD, 0xFD, 0x1F, 0x44, 0xB5, 0x93, 0x8F, 0x0A,
|
||||
0x14, 0x04,
|
||||
],
|
||||
hash_128_x64: [
|
||||
0xD3, 0x27, 0xB3, 0x85, 0x13, 0xFB, 0x84, 0x2A, 0xC1, 0xDF, 0xE0, 0x7D, 0x85, 0x95,
|
||||
0xEB, 0xDA,
|
||||
],
|
||||
},
|
||||
Result {
|
||||
string: "123456789012",
|
||||
hash_32: 0x6c75e419,
|
||||
hash_128_x86: [
|
||||
0x99, 0x7E, 0x6F, 0x80, 0x1C, 0x4F, 0x20, 0x74, 0xCB, 0x0E, 0x11, 0xFB, 0xF1, 0xE4,
|
||||
0x3F, 0x41,
|
||||
],
|
||||
hash_128_x64: [
|
||||
0x14, 0x29, 0x02, 0x7C, 0x8B, 0xE3, 0xA6, 0xDD, 0x1E, 0x9D, 0x71, 0xFD, 0x83, 0x39,
|
||||
0xA2, 0x75,
|
||||
],
|
||||
},
|
||||
Result {
|
||||
string: "1234567890123",
|
||||
hash_32: 0xcaf7e549,
|
||||
hash_128_x86: [
|
||||
0x83, 0xA6, 0x21, 0xBE, 0xBB, 0x3E, 0xF4, 0x38, 0x22, 0xC8, 0x85, 0x19, 0x3D, 0x7D,
|
||||
0xED, 0xBB,
|
||||
],
|
||||
hash_128_x64: [
|
||||
0x49, 0xDF, 0x72, 0x37, 0x85, 0xF2, 0xDD, 0xE3, 0x97, 0x24, 0xEF, 0x5E, 0xF0, 0x21,
|
||||
0xC5, 0x1B,
|
||||
],
|
||||
},
|
||||
Result {
|
||||
string: "12345678901234",
|
||||
hash_32: 0x57ae5bd1,
|
||||
hash_128_x86: [
|
||||
0xD8, 0xC7, 0x1E, 0x23, 0x6A, 0x9B, 0x8D, 0xAC, 0x8D, 0xC4, 0xA2, 0xA0, 0x96, 0xAF,
|
||||
0x97, 0x3F,
|
||||
],
|
||||
hash_128_x64: [
|
||||
0x91, 0xCC, 0x3C, 0xE8, 0x70, 0xE1, 0x51, 0x7D, 0xD0, 0x5A, 0xF8, 0xFA, 0xBE, 0x6C,
|
||||
0x3D, 0xC6,
|
||||
],
|
||||
},
|
||||
Result {
|
||||
string: "123456789012345",
|
||||
hash_32: 0x09bb660c,
|
||||
hash_128_x86: [
|
||||
0x78, 0x0A, 0x91, 0x78, 0x23, 0xC9, 0x84, 0xD4, 0x03, 0xF9, 0x0A, 0xC3, 0xDB, 0x30,
|
||||
0x55, 0x12,
|
||||
],
|
||||
hash_128_x64: [
|
||||
0xD6, 0xCF, 0xAF, 0xA2, 0xAE, 0x01, 0x70, 0x88, 0xB3, 0x01, 0x08, 0x4F, 0x36, 0x26,
|
||||
0xC3, 0x1E,
|
||||
],
|
||||
},
|
||||
Result {
|
||||
string: "1234567890123456",
|
||||
hash_32: 0x06b2ff24,
|
||||
hash_128_x86: [
|
||||
0xB8, 0xDF, 0x3D, 0x20, 0x83, 0x3D, 0xF4, 0x19, 0x4C, 0xB4, 0x40, 0x3F, 0xBD, 0xA0,
|
||||
0xD7, 0xD2,
|
||||
],
|
||||
hash_128_x64: [
|
||||
0xF8, 0x2C, 0xE3, 0xC0, 0xC5, 0x5D, 0xBE, 0x4F, 0xC1, 0x22, 0xC3, 0x60, 0x6B, 0xE9,
|
||||
0xC8, 0xC0,
|
||||
],
|
||||
},
|
||||
Result {
|
||||
string: "12345678901234567",
|
||||
hash_32: 0xc50a5d2b,
|
||||
hash_128_x86: [
|
||||
0x6F, 0x8B, 0x41, 0x43, 0x9E, 0x40, 0xE2, 0x6C, 0x42, 0x31, 0x9E, 0x9D, 0x7C, 0x80,
|
||||
0x9A, 0x40,
|
||||
],
|
||||
hash_128_x64: [
|
||||
0x7E, 0xB7, 0x26, 0x80, 0x96, 0x17, 0x86, 0x74, 0x03, 0x71, 0x3F, 0x47, 0x86, 0x63,
|
||||
0x1E, 0x29,
|
||||
],
|
||||
},
|
||||
Result {
|
||||
string: "123456789012345678",
|
||||
hash_32: 0xe970a44f,
|
||||
hash_128_x86: [
|
||||
0xC6, 0x05, 0xE9, 0x5C, 0x08, 0xD2, 0x0D, 0x92, 0x89, 0x2C, 0x38, 0x68, 0x3F, 0x8A,
|
||||
0x96, 0x4F,
|
||||
],
|
||||
hash_128_x64: [
|
||||
0xAF, 0x61, 0xA9, 0xCF, 0x1C, 0xE5, 0xEA, 0xEA, 0x69, 0x04, 0xCC, 0x52, 0x7D, 0x65,
|
||||
0x4C, 0x75,
|
||||
],
|
||||
},
|
||||
Result {
|
||||
string: "1234567890123456789",
|
||||
hash_32: 0xf7c5400e,
|
||||
hash_128_x86: [
|
||||
0x7C, 0x88, 0x97, 0x5A, 0xA2, 0xCE, 0x7F, 0x0C, 0xD8, 0xE6, 0xA2, 0x29, 0xE0, 0x61,
|
||||
0x05, 0x26,
|
||||
],
|
||||
hash_128_x64: [
|
||||
0x59, 0x99, 0x47, 0x0A, 0xBA, 0x2F, 0x72, 0x0C, 0x2A, 0x8A, 0x21, 0x12, 0x69, 0xCD,
|
||||
0xBB, 0x4E,
|
||||
],
|
||||
},
|
||||
Result {
|
||||
string: "12345678901234567890",
|
||||
hash_32: 0x45e28067,
|
||||
hash_128_x86: [
|
||||
0xE1, 0x93, 0x21, 0x22, 0x7E, 0xAA, 0x15, 0x07, 0xA6, 0x22, 0x87, 0xCD, 0x54, 0x55,
|
||||
0x9E, 0x1E,
|
||||
],
|
||||
hash_128_x64: [
|
||||
0x3A, 0x8C, 0xDC, 0x25, 0x19, 0xD8, 0x1C, 0xB1, 0x7D, 0x36, 0xF1, 0xE8, 0x3C, 0x60,
|
||||
0x9F, 0x71,
|
||||
],
|
||||
},
|
||||
Result {
|
||||
string: "123456789012345678901",
|
||||
hash_32: 0x7b4f3da6,
|
||||
hash_128_x86: [
|
||||
0xE3, 0x50, 0x2D, 0xFB, 0x0F, 0x03, 0x6F, 0x39, 0xA3, 0x83, 0x11, 0xEA, 0x5E, 0xB6,
|
||||
0x85, 0x9A,
|
||||
],
|
||||
hash_128_x64: [
|
||||
0x55, 0x68, 0xEE, 0x16, 0x3C, 0xF2, 0xD7, 0xA2, 0xD3, 0x3D, 0xF5, 0xA5, 0x02, 0x37,
|
||||
0xE6, 0xFE,
|
||||
],
|
||||
},
|
||||
Result {
|
||||
string: "1234567890123456789010",
|
||||
hash_32: 0x1e4a77ff,
|
||||
hash_128_x86: [
|
||||
0xFE, 0x78, 0x3B, 0x50, 0x3D, 0x5A, 0x45, 0x33, 0xA7, 0xCB, 0x0F, 0x53, 0xB9, 0xF0,
|
||||
0xAB, 0x36,
|
||||
],
|
||||
hash_128_x64: [
|
||||
0x76, 0x70, 0x7E, 0xAE, 0xC7, 0x8B, 0x20, 0x37, 0xAF, 0xB8, 0xAB, 0x7A, 0x58, 0x79,
|
||||
0xA9, 0xEF,
|
||||
],
|
||||
},
|
||||
Result {
|
||||
string: "€",
|
||||
hash_32: 0x5b43fca5,
|
||||
hash_128_x86: [
|
||||
0x4C, 0xF5, 0x4D, 0xC, 0x9F, 0x57, 0x9A, 0xBA, 0x9F, 0x57, 0x9A, 0xBA, 0x9F, 0x57,
|
||||
0x9A, 0xBA,
|
||||
],
|
||||
hash_128_x64: [
|
||||
0x55, 0x95, 0xDD, 0x2F, 0x3A, 0x30, 0xE3, 0x59, 0x64, 0x31, 0xBC, 0xE4, 0xB3, 0x8B,
|
||||
0x9D, 0x4F,
|
||||
],
|
||||
},
|
||||
Result {
|
||||
string: "€€€€€€€€€€",
|
||||
hash_32: 0xda3c1253,
|
||||
hash_128_x86: [
|
||||
0xE5, 0xBB, 0xF1, 0xB2, 0x53, 0xDC, 0xB5, 0x92, 0x78, 0x4E, 0x71, 0xDE, 0x44, 0x38,
|
||||
0x31, 0xC5,
|
||||
],
|
||||
hash_128_x64: [
|
||||
0x6F, 0xEF, 0x5E, 0x37, 0x77, 0xEB, 0xCF, 0xCE, 0xC6, 0xE2, 0x69, 0x68, 0xC2, 0xB,
|
||||
0x83, 0xE9,
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
fn str_as_cursor(string: &str) -> Cursor<&[u8]> {
|
||||
Cursor::new(string.as_bytes())
|
||||
}
|
||||
|
||||
fn str_as_chained_cursor(string: &'static str) -> impl Read {
|
||||
let string = string.as_bytes();
|
||||
let mut result: Box<dyn Read> = Box::new(Cursor::new("".as_bytes()));
|
||||
for i in 0..string.len() {
|
||||
result = Box::new(result.chain(Cursor::new(&string[i..i + 1])));
|
||||
}
|
||||
result
|
||||
}
|
||||
|
||||
for test in &tests {
|
||||
assert_eq!(
|
||||
murmur3::murmur3_32(&mut str_as_cursor(test.string), 0).unwrap(),
|
||||
test.hash_32,
|
||||
"Failed 32 on string {}",
|
||||
test.string
|
||||
);
|
||||
|
||||
assert_eq!(
|
||||
murmur3::murmur3_32_of_slice(test.string.as_bytes(), 0),
|
||||
test.hash_32,
|
||||
"Failed 32_of_slice on string {}",
|
||||
test.string,
|
||||
);
|
||||
|
||||
let mut string = String::new();
|
||||
str_as_chained_cursor(test.string)
|
||||
.read_to_string(&mut string)
|
||||
.unwrap();
|
||||
assert_eq!(
|
||||
murmur3::murmur3_32(&mut str_as_chained_cursor(test.string), 0).unwrap(),
|
||||
test.hash_32,
|
||||
"Failed 32 chained reader on string {}, reader value {}",
|
||||
test.string,
|
||||
string
|
||||
);
|
||||
|
||||
let expected = u128::from_le_bytes(test.hash_128_x86);
|
||||
let hash = murmur3::murmur3_x86_128(&mut str_as_cursor(test.string), 0).unwrap();
|
||||
assert_eq!(hash, expected, "Failed x86_128 on string {}", test.string);
|
||||
let chained_hash =
|
||||
murmur3::murmur3_x86_128(&mut str_as_chained_cursor(test.string), 0).unwrap();
|
||||
assert_eq!(
|
||||
chained_hash, expected,
|
||||
"Failed x86_128 chained reader on string {}",
|
||||
test.string
|
||||
);
|
||||
|
||||
let expected = u128::from_le_bytes(test.hash_128_x64);
|
||||
let hash = murmur3::murmur3_x64_128(&mut str_as_cursor(test.string), 0).unwrap();
|
||||
assert_eq!(hash, expected, "Failed on string {}", test.string);
|
||||
let chained_hash =
|
||||
murmur3::murmur3_x64_128(&mut str_as_chained_cursor(test.string), 0).unwrap();
|
||||
assert_eq!(
|
||||
chained_hash, expected,
|
||||
"Failed x64_128 chained reader on string {}",
|
||||
test.string
|
||||
);
|
||||
}
|
||||
}
|
@ -13,6 +13,7 @@ sword_crypto = { path = "../sword_crypto" }
|
||||
sword_macros = { path = "../sword_macros" }
|
||||
sword_pma = { path = "../sword_pma" }
|
||||
assert_no_alloc = { path = "../assert_no_alloc" }
|
||||
murmur3 = { path = "../murmur3" }
|
||||
bitvec = "1.0.0"
|
||||
criterion = "0.4"
|
||||
either = "1.9.0"
|
||||
@ -22,7 +23,6 @@ json = "0.12.4"
|
||||
lazy_static = "1.4.0"
|
||||
libc = "0.2.126"
|
||||
memmap = "0.7.0"
|
||||
murmur3 = { git = "https://github.com/tloncorp/murmur3", rev = "7878a0f" }
|
||||
num-derive = "0.3"
|
||||
num-traits = "0.2"
|
||||
signal-hook = "0.3"
|
||||
|
Loading…
Reference in New Issue
Block a user