iscc-lib 0.0.4__tar.gz → 0.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {iscc_lib-0.0.4 → iscc_lib-0.2.0}/Cargo.lock +171 -8
- {iscc_lib-0.0.4 → iscc_lib-0.2.0}/Cargo.toml +2 -1
- {iscc_lib-0.0.4 → iscc_lib-0.2.0}/PKG-INFO +1 -4
- {iscc_lib-0.0.4/crates/iscc-py → iscc_lib-0.2.0}/README.md +0 -3
- {iscc_lib-0.0.4 → iscc_lib-0.2.0}/crates/iscc-lib/Cargo.toml +8 -3
- {iscc_lib-0.0.4 → iscc_lib-0.2.0}/crates/iscc-lib/README.md +0 -3
- {iscc_lib-0.0.4 → iscc_lib-0.2.0}/crates/iscc-lib/benches/benchmarks.rs +19 -3
- {iscc_lib-0.0.4 → iscc_lib-0.2.0}/crates/iscc-lib/src/cdc.rs +55 -12
- {iscc_lib-0.0.4 → iscc_lib-0.2.0}/crates/iscc-lib/src/conformance.rs +28 -13
- {iscc_lib-0.0.4 → iscc_lib-0.2.0}/crates/iscc-lib/src/lib.rs +138 -14
- {iscc_lib-0.0.4 → iscc_lib-0.2.0}/crates/iscc-lib/src/simhash.rs +15 -0
- {iscc_lib-0.0.4 → iscc_lib-0.2.0}/crates/iscc-lib/src/streaming.rs +1 -1
- {iscc_lib-0.0.4 → iscc_lib-0.2.0}/crates/iscc-lib/src/types.rs +3 -0
- {iscc_lib-0.0.4 → iscc_lib-0.2.0}/crates/iscc-lib/src/utils.rs +18 -0
- {iscc_lib-0.0.4 → iscc_lib-0.2.0}/crates/iscc-lib/tests/data.json +61 -0
- {iscc_lib-0.0.4 → iscc_lib-0.2.0}/crates/iscc-lib/tests/test_algorithm_primitives.rs +8 -8
- {iscc_lib-0.0.4 → iscc_lib-0.2.0}/crates/iscc-lib/tests/test_text_utils.rs +27 -4
- {iscc_lib-0.0.4 → iscc_lib-0.2.0}/crates/iscc-py/Cargo.toml +2 -1
- {iscc_lib-0.0.4 → iscc_lib-0.2.0/crates/iscc-py}/README.md +0 -3
- {iscc_lib-0.0.4 → iscc_lib-0.2.0}/crates/iscc-py/src/lib.rs +18 -7
- {iscc_lib-0.0.4 → iscc_lib-0.2.0}/python/iscc_lib/__init__.py +6 -2
- {iscc_lib-0.0.4 → iscc_lib-0.2.0}/python/iscc_lib/_lowlevel.pyi +8 -2
- {iscc_lib-0.0.4 → iscc_lib-0.2.0}/crates/iscc-lib/CLAUDE.md +0 -0
- {iscc_lib-0.0.4 → iscc_lib-0.2.0}/crates/iscc-lib/src/codec.rs +0 -0
- {iscc_lib-0.0.4 → iscc_lib-0.2.0}/crates/iscc-lib/src/dct.rs +0 -0
- {iscc_lib-0.0.4 → iscc_lib-0.2.0}/crates/iscc-lib/src/minhash.rs +0 -0
- {iscc_lib-0.0.4 → iscc_lib-0.2.0}/crates/iscc-lib/src/wtahash.rs +0 -0
- {iscc_lib-0.0.4 → iscc_lib-0.2.0}/crates/iscc-py/CLAUDE.md +0 -0
- {iscc_lib-0.0.4 → iscc_lib-0.2.0}/crates/iscc-py/uv.lock +0 -0
- {iscc_lib-0.0.4 → iscc_lib-0.2.0}/pyproject.toml +0 -0
- {iscc_lib-0.0.4 → iscc_lib-0.2.0}/python/iscc_lib/py.typed +0 -0
|
@@ -58,6 +58,26 @@ version = "1.5.0"
|
|
|
58
58
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
59
59
|
checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8"
|
|
60
60
|
|
|
61
|
+
[[package]]
|
|
62
|
+
name = "bindgen"
|
|
63
|
+
version = "0.69.5"
|
|
64
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
65
|
+
checksum = "271383c67ccabffb7381723dea0672a673f292304fcb45c01cc648c7a8d58088"
|
|
66
|
+
dependencies = [
|
|
67
|
+
"bitflags",
|
|
68
|
+
"cexpr",
|
|
69
|
+
"clang-sys",
|
|
70
|
+
"itertools",
|
|
71
|
+
"lazy_static",
|
|
72
|
+
"lazycell",
|
|
73
|
+
"proc-macro2",
|
|
74
|
+
"quote",
|
|
75
|
+
"regex",
|
|
76
|
+
"rustc-hash 1.1.0",
|
|
77
|
+
"shlex",
|
|
78
|
+
"syn",
|
|
79
|
+
]
|
|
80
|
+
|
|
61
81
|
[[package]]
|
|
62
82
|
name = "bitflags"
|
|
63
83
|
version = "2.11.0"
|
|
@@ -112,6 +132,15 @@ version = "1.1.0"
|
|
|
112
132
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
113
133
|
checksum = "6d43a04d8753f35258c91f8ec639f792891f748a1edbd759cf1dcea3382ad83c"
|
|
114
134
|
|
|
135
|
+
[[package]]
|
|
136
|
+
name = "cexpr"
|
|
137
|
+
version = "0.6.0"
|
|
138
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
139
|
+
checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766"
|
|
140
|
+
dependencies = [
|
|
141
|
+
"nom",
|
|
142
|
+
]
|
|
143
|
+
|
|
115
144
|
[[package]]
|
|
116
145
|
name = "cfg-if"
|
|
117
146
|
version = "1.0.4"
|
|
@@ -145,6 +174,17 @@ dependencies = [
|
|
|
145
174
|
"half",
|
|
146
175
|
]
|
|
147
176
|
|
|
177
|
+
[[package]]
|
|
178
|
+
name = "clang-sys"
|
|
179
|
+
version = "1.8.1"
|
|
180
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
181
|
+
checksum = "0b023947811758c97c59bf9d1c188fd619ad4718dcaa767947df1cadb14f39f4"
|
|
182
|
+
dependencies = [
|
|
183
|
+
"glob",
|
|
184
|
+
"libc",
|
|
185
|
+
"libloading 0.8.9",
|
|
186
|
+
]
|
|
187
|
+
|
|
148
188
|
[[package]]
|
|
149
189
|
name = "clap"
|
|
150
190
|
version = "4.5.60"
|
|
@@ -449,6 +489,12 @@ dependencies = [
|
|
|
449
489
|
"wasip3",
|
|
450
490
|
]
|
|
451
491
|
|
|
492
|
+
[[package]]
|
|
493
|
+
name = "glob"
|
|
494
|
+
version = "0.3.3"
|
|
495
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
496
|
+
checksum = "0cc23270f6e1808e30a928bdc84dea0b9b4136a8bc82338574f23baf47bbd280"
|
|
497
|
+
|
|
452
498
|
[[package]]
|
|
453
499
|
name = "half"
|
|
454
500
|
version = "2.7.1"
|
|
@@ -533,14 +579,14 @@ dependencies = [
|
|
|
533
579
|
|
|
534
580
|
[[package]]
|
|
535
581
|
name = "iscc-ffi"
|
|
536
|
-
version = "0.0
|
|
582
|
+
version = "0.2.0"
|
|
537
583
|
dependencies = [
|
|
538
584
|
"iscc-lib",
|
|
539
585
|
]
|
|
540
586
|
|
|
541
587
|
[[package]]
|
|
542
588
|
name = "iscc-jni"
|
|
543
|
-
version = "0.0
|
|
589
|
+
version = "0.2.0"
|
|
544
590
|
dependencies = [
|
|
545
591
|
"iscc-lib",
|
|
546
592
|
"jni",
|
|
@@ -548,7 +594,7 @@ dependencies = [
|
|
|
548
594
|
|
|
549
595
|
[[package]]
|
|
550
596
|
name = "iscc-lib"
|
|
551
|
-
version = "0.0
|
|
597
|
+
version = "0.2.0"
|
|
552
598
|
dependencies = [
|
|
553
599
|
"blake3",
|
|
554
600
|
"criterion",
|
|
@@ -566,7 +612,7 @@ dependencies = [
|
|
|
566
612
|
|
|
567
613
|
[[package]]
|
|
568
614
|
name = "iscc-napi"
|
|
569
|
-
version = "0.0
|
|
615
|
+
version = "0.2.0"
|
|
570
616
|
dependencies = [
|
|
571
617
|
"iscc-lib",
|
|
572
618
|
"napi",
|
|
@@ -576,15 +622,23 @@ dependencies = [
|
|
|
576
622
|
|
|
577
623
|
[[package]]
|
|
578
624
|
name = "iscc-py"
|
|
579
|
-
version = "0.0
|
|
625
|
+
version = "0.2.0"
|
|
580
626
|
dependencies = [
|
|
581
627
|
"iscc-lib",
|
|
582
628
|
"pyo3",
|
|
583
629
|
]
|
|
584
630
|
|
|
631
|
+
[[package]]
|
|
632
|
+
name = "iscc-rb"
|
|
633
|
+
version = "0.2.0"
|
|
634
|
+
dependencies = [
|
|
635
|
+
"iscc-lib",
|
|
636
|
+
"magnus",
|
|
637
|
+
]
|
|
638
|
+
|
|
585
639
|
[[package]]
|
|
586
640
|
name = "iscc-wasm"
|
|
587
|
-
version = "0.0
|
|
641
|
+
version = "0.2.0"
|
|
588
642
|
dependencies = [
|
|
589
643
|
"hex",
|
|
590
644
|
"iscc-lib",
|
|
@@ -642,6 +696,18 @@ dependencies = [
|
|
|
642
696
|
"wasm-bindgen",
|
|
643
697
|
]
|
|
644
698
|
|
|
699
|
+
[[package]]
|
|
700
|
+
name = "lazy_static"
|
|
701
|
+
version = "1.5.0"
|
|
702
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
703
|
+
checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
|
|
704
|
+
|
|
705
|
+
[[package]]
|
|
706
|
+
name = "lazycell"
|
|
707
|
+
version = "1.3.0"
|
|
708
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
709
|
+
checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
|
|
710
|
+
|
|
645
711
|
[[package]]
|
|
646
712
|
name = "leb128fmt"
|
|
647
713
|
version = "0.1.0"
|
|
@@ -654,6 +720,16 @@ version = "0.2.182"
|
|
|
654
720
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
655
721
|
checksum = "6800badb6cb2082ffd7b6a67e6125bb39f18782f793520caee8cb8846be06112"
|
|
656
722
|
|
|
723
|
+
[[package]]
|
|
724
|
+
name = "libloading"
|
|
725
|
+
version = "0.8.9"
|
|
726
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
727
|
+
checksum = "d7c4b02199fee7c5d21a5ae7d8cfa79a6ef5bb2fc834d6e9058e89c825efdc55"
|
|
728
|
+
dependencies = [
|
|
729
|
+
"cfg-if",
|
|
730
|
+
"windows-link",
|
|
731
|
+
]
|
|
732
|
+
|
|
657
733
|
[[package]]
|
|
658
734
|
name = "libloading"
|
|
659
735
|
version = "0.9.0"
|
|
@@ -682,6 +758,29 @@ version = "0.4.29"
|
|
|
682
758
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
683
759
|
checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897"
|
|
684
760
|
|
|
761
|
+
[[package]]
|
|
762
|
+
name = "magnus"
|
|
763
|
+
version = "0.7.1"
|
|
764
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
765
|
+
checksum = "3d87ae53030f3a22e83879e666cb94e58a7bdf31706878a0ba48752994146dab"
|
|
766
|
+
dependencies = [
|
|
767
|
+
"magnus-macros",
|
|
768
|
+
"rb-sys",
|
|
769
|
+
"rb-sys-env",
|
|
770
|
+
"seq-macro",
|
|
771
|
+
]
|
|
772
|
+
|
|
773
|
+
[[package]]
|
|
774
|
+
name = "magnus-macros"
|
|
775
|
+
version = "0.6.0"
|
|
776
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
777
|
+
checksum = "5968c820e2960565f647819f5928a42d6e874551cab9d88d75e3e0660d7f71e3"
|
|
778
|
+
dependencies = [
|
|
779
|
+
"proc-macro2",
|
|
780
|
+
"quote",
|
|
781
|
+
"syn",
|
|
782
|
+
]
|
|
783
|
+
|
|
685
784
|
[[package]]
|
|
686
785
|
name = "memchr"
|
|
687
786
|
version = "2.8.0"
|
|
@@ -707,6 +806,12 @@ dependencies = [
|
|
|
707
806
|
"walkdir",
|
|
708
807
|
]
|
|
709
808
|
|
|
809
|
+
[[package]]
|
|
810
|
+
name = "minimal-lexical"
|
|
811
|
+
version = "0.2.1"
|
|
812
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
813
|
+
checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
|
|
814
|
+
|
|
710
815
|
[[package]]
|
|
711
816
|
name = "napi"
|
|
712
817
|
version = "3.8.3"
|
|
@@ -719,7 +824,7 @@ dependencies = [
|
|
|
719
824
|
"napi-build",
|
|
720
825
|
"napi-sys",
|
|
721
826
|
"nohash-hasher",
|
|
722
|
-
"rustc-hash",
|
|
827
|
+
"rustc-hash 2.1.1",
|
|
723
828
|
]
|
|
724
829
|
|
|
725
830
|
[[package]]
|
|
@@ -761,7 +866,7 @@ version = "3.2.1"
|
|
|
761
866
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
762
867
|
checksum = "8eb602b84d7c1edae45e50bbf1374696548f36ae179dfa667f577e384bb90c2b"
|
|
763
868
|
dependencies = [
|
|
764
|
-
"libloading",
|
|
869
|
+
"libloading 0.9.0",
|
|
765
870
|
]
|
|
766
871
|
|
|
767
872
|
[[package]]
|
|
@@ -770,6 +875,16 @@ version = "0.2.0"
|
|
|
770
875
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
771
876
|
checksum = "2bf50223579dc7cdcfb3bfcacf7069ff68243f8c363f62ffa99cf000a6b9c451"
|
|
772
877
|
|
|
878
|
+
[[package]]
|
|
879
|
+
name = "nom"
|
|
880
|
+
version = "7.1.3"
|
|
881
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
882
|
+
checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a"
|
|
883
|
+
dependencies = [
|
|
884
|
+
"memchr",
|
|
885
|
+
"minimal-lexical",
|
|
886
|
+
]
|
|
887
|
+
|
|
773
888
|
[[package]]
|
|
774
889
|
name = "nu-ansi-term"
|
|
775
890
|
version = "0.50.3"
|
|
@@ -958,6 +1073,36 @@ dependencies = [
|
|
|
958
1073
|
"crossbeam-utils",
|
|
959
1074
|
]
|
|
960
1075
|
|
|
1076
|
+
[[package]]
|
|
1077
|
+
name = "rb-sys"
|
|
1078
|
+
version = "0.9.124"
|
|
1079
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1080
|
+
checksum = "c85c4188462601e2aa1469def389c17228566f82ea72f137ed096f21591bc489"
|
|
1081
|
+
dependencies = [
|
|
1082
|
+
"rb-sys-build",
|
|
1083
|
+
]
|
|
1084
|
+
|
|
1085
|
+
[[package]]
|
|
1086
|
+
name = "rb-sys-build"
|
|
1087
|
+
version = "0.9.124"
|
|
1088
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1089
|
+
checksum = "568068db4102230882e6d4ae8de6632e224ca75fe5970f6e026a04e91ed635d3"
|
|
1090
|
+
dependencies = [
|
|
1091
|
+
"bindgen",
|
|
1092
|
+
"lazy_static",
|
|
1093
|
+
"proc-macro2",
|
|
1094
|
+
"quote",
|
|
1095
|
+
"regex",
|
|
1096
|
+
"shell-words",
|
|
1097
|
+
"syn",
|
|
1098
|
+
]
|
|
1099
|
+
|
|
1100
|
+
[[package]]
|
|
1101
|
+
name = "rb-sys-env"
|
|
1102
|
+
version = "0.1.2"
|
|
1103
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1104
|
+
checksum = "a35802679f07360454b418a5d1735c89716bde01d35b1560fc953c1415a0b3bb"
|
|
1105
|
+
|
|
961
1106
|
[[package]]
|
|
962
1107
|
name = "regex"
|
|
963
1108
|
version = "1.12.3"
|
|
@@ -987,6 +1132,12 @@ version = "0.8.9"
|
|
|
987
1132
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
988
1133
|
checksum = "a96887878f22d7bad8a3b6dc5b7440e0ada9a245242924394987b21cf2210a4c"
|
|
989
1134
|
|
|
1135
|
+
[[package]]
|
|
1136
|
+
name = "rustc-hash"
|
|
1137
|
+
version = "1.1.0"
|
|
1138
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1139
|
+
checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
|
|
1140
|
+
|
|
990
1141
|
[[package]]
|
|
991
1142
|
name = "rustc-hash"
|
|
992
1143
|
version = "2.1.1"
|
|
@@ -1033,6 +1184,12 @@ version = "1.0.27"
|
|
|
1033
1184
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1034
1185
|
checksum = "d767eb0aabc880b29956c35734170f26ed551a859dbd361d140cdbeca61ab1e2"
|
|
1035
1186
|
|
|
1187
|
+
[[package]]
|
|
1188
|
+
name = "seq-macro"
|
|
1189
|
+
version = "0.3.6"
|
|
1190
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1191
|
+
checksum = "1bc711410fbe7399f390ca1c3b60ad0f53f80e95c5eb935e52268a0e2cd49acc"
|
|
1192
|
+
|
|
1036
1193
|
[[package]]
|
|
1037
1194
|
name = "serde"
|
|
1038
1195
|
version = "1.0.228"
|
|
@@ -1098,6 +1255,12 @@ dependencies = [
|
|
|
1098
1255
|
"serde_json",
|
|
1099
1256
|
]
|
|
1100
1257
|
|
|
1258
|
+
[[package]]
|
|
1259
|
+
name = "shell-words"
|
|
1260
|
+
version = "1.1.1"
|
|
1261
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1262
|
+
checksum = "dc6fe69c597f9c37bfeeeeeb33da3530379845f10be461a66d16d03eca2ded77"
|
|
1263
|
+
|
|
1101
1264
|
[[package]]
|
|
1102
1265
|
name = "shlex"
|
|
1103
1266
|
version = "1.3.0"
|
|
@@ -3,7 +3,7 @@ resolver = "2"
|
|
|
3
3
|
members = ["crates/iscc-lib", "crates/iscc-py"]
|
|
4
4
|
|
|
5
5
|
[workspace.package]
|
|
6
|
-
version = "0.0
|
|
6
|
+
version = "0.2.0"
|
|
7
7
|
edition = "2024"
|
|
8
8
|
rust-version = "1.85"
|
|
9
9
|
authors = ["Titusz Pan <tp@py7.de>"]
|
|
@@ -33,6 +33,7 @@ serde-wasm-bindgen = "0.6"
|
|
|
33
33
|
criterion = { version = "0.5", features = ["html_reports"] }
|
|
34
34
|
tempfile = "3"
|
|
35
35
|
jni = "0.21"
|
|
36
|
+
magnus = { version = "0.7", features = ["rb-sys"] }
|
|
36
37
|
|
|
37
38
|
[profile.release]
|
|
38
39
|
lto = true
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: iscc-lib
|
|
3
|
-
Version: 0.0
|
|
3
|
+
Version: 0.2.0
|
|
4
4
|
Classifier: Development Status :: 2 - Pre-Alpha
|
|
5
5
|
Classifier: Intended Audience :: Developers
|
|
6
6
|
Classifier: License :: OSI Approved :: Apache Software License
|
|
@@ -32,9 +32,6 @@ Project-URL: Repository, https://github.com/iscc/iscc-lib
|
|
|
32
32
|
[](https://pypi.org/project/iscc-lib/)
|
|
33
33
|
[](https://opensource.org/licenses/Apache-2.0)
|
|
34
34
|
|
|
35
|
-
> **Experimental:** This library is in early development (v0.0.x). APIs may change without notice.
|
|
36
|
-
> Not recommended for production use yet.
|
|
37
|
-
|
|
38
35
|
High-performance Python bindings for [ISO 24138:2024](https://www.iso.org/standard/77899.html) --
|
|
39
36
|
International Standard Content Code (ISCC). Built on a Rust core for speed, with a Pythonic API that
|
|
40
37
|
is a drop-in replacement for [iscc-core](https://github.com/iscc/iscc-core).
|
|
@@ -4,9 +4,6 @@
|
|
|
4
4
|
[](https://pypi.org/project/iscc-lib/)
|
|
5
5
|
[](https://opensource.org/licenses/Apache-2.0)
|
|
6
6
|
|
|
7
|
-
> **Experimental:** This library is in early development (v0.0.x). APIs may change without notice.
|
|
8
|
-
> Not recommended for production use yet.
|
|
9
|
-
|
|
10
7
|
High-performance Python bindings for [ISO 24138:2024](https://www.iso.org/standard/77899.html) --
|
|
11
8
|
International Standard Content Code (ISCC). Built on a Rust core for speed, with a Pythonic API that
|
|
12
9
|
is a drop-in replacement for [iscc-core](https://github.com/iscc/iscc-core).
|
|
@@ -12,15 +12,20 @@ readme = "README.md"
|
|
|
12
12
|
keywords = ["iscc", "content-id", "media", "fingerprint", "iso"]
|
|
13
13
|
categories = ["multimedia", "encoding", "cryptography"]
|
|
14
14
|
|
|
15
|
+
[features]
|
|
16
|
+
default = ["meta-code"]
|
|
17
|
+
text-processing = ["dep:unicode-normalization", "dep:unicode-general-category"]
|
|
18
|
+
meta-code = ["text-processing", "dep:serde_json_canonicalizer"]
|
|
19
|
+
|
|
15
20
|
[dependencies]
|
|
16
21
|
blake3.workspace = true
|
|
17
22
|
data-encoding.workspace = true
|
|
18
23
|
hex.workspace = true
|
|
19
24
|
serde_json.workspace = true
|
|
20
|
-
serde_json_canonicalizer
|
|
25
|
+
serde_json_canonicalizer = { workspace = true, optional = true }
|
|
21
26
|
thiserror.workspace = true
|
|
22
|
-
unicode-normalization
|
|
23
|
-
unicode-general-category
|
|
27
|
+
unicode-normalization = { workspace = true, optional = true }
|
|
28
|
+
unicode-general-category = { workspace = true, optional = true }
|
|
24
29
|
xxhash-rust.workspace = true
|
|
25
30
|
|
|
26
31
|
[dev-dependencies]
|
|
@@ -4,9 +4,6 @@
|
|
|
4
4
|
[](https://crates.io/crates/iscc-lib)
|
|
5
5
|
[](https://opensource.org/licenses/Apache-2.0)
|
|
6
6
|
|
|
7
|
-
> **Experimental:** This library is in early development (v0.0.x). APIs may change without notice.
|
|
8
|
-
> Not recommended for production use yet.
|
|
9
|
-
|
|
10
7
|
High-performance Rust implementation of [ISO 24138:2024](https://www.iso.org/standard/77899.html) --
|
|
11
8
|
International Standard Content Code (ISCC).
|
|
12
9
|
|
|
@@ -196,7 +196,15 @@ fn bench_sum_code(c: &mut Criterion) {
|
|
|
196
196
|
BenchmarkId::new("throughput", "64KB"),
|
|
197
197
|
&path_64k,
|
|
198
198
|
|b, path| {
|
|
199
|
-
b.iter(||
|
|
199
|
+
b.iter(|| {
|
|
200
|
+
gen_sum_code_v0(
|
|
201
|
+
black_box(path),
|
|
202
|
+
black_box(64),
|
|
203
|
+
black_box(false),
|
|
204
|
+
black_box(false),
|
|
205
|
+
)
|
|
206
|
+
.unwrap()
|
|
207
|
+
})
|
|
200
208
|
},
|
|
201
209
|
);
|
|
202
210
|
|
|
@@ -211,7 +219,15 @@ fn bench_sum_code(c: &mut Criterion) {
|
|
|
211
219
|
BenchmarkId::new("throughput", "1MB"),
|
|
212
220
|
&path_1m,
|
|
213
221
|
|b, path| {
|
|
214
|
-
b.iter(||
|
|
222
|
+
b.iter(|| {
|
|
223
|
+
gen_sum_code_v0(
|
|
224
|
+
black_box(path),
|
|
225
|
+
black_box(64),
|
|
226
|
+
black_box(false),
|
|
227
|
+
black_box(false),
|
|
228
|
+
)
|
|
229
|
+
.unwrap()
|
|
230
|
+
})
|
|
215
231
|
},
|
|
216
232
|
);
|
|
217
233
|
|
|
@@ -252,7 +268,7 @@ fn bench_cdc_chunks(c: &mut Criterion) {
|
|
|
252
268
|
};
|
|
253
269
|
group.throughput(Throughput::Bytes(size as u64));
|
|
254
270
|
group.bench_with_input(BenchmarkId::new("throughput", label), &data, |b, data| {
|
|
255
|
-
b.iter(|| alg_cdc_chunks(black_box(data), black_box(false), black_box(1024)))
|
|
271
|
+
b.iter(|| alg_cdc_chunks(black_box(data), black_box(false), black_box(1024)).unwrap())
|
|
256
272
|
});
|
|
257
273
|
}
|
|
258
274
|
|
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
//! Splits byte data into variable-size chunks with content-dependent boundaries,
|
|
5
5
|
//! enabling similarity detection across different versions of binary data.
|
|
6
6
|
|
|
7
|
+
use crate::{IsccError, IsccResult};
|
|
8
|
+
|
|
7
9
|
/// Gear rolling hash lookup table (256 entries).
|
|
8
10
|
///
|
|
9
11
|
/// Fixed constant from iscc-core `cdc_gear` option. Each byte value maps to
|
|
@@ -168,7 +170,29 @@ pub(crate) fn alg_cdc_offset(
|
|
|
168
170
|
/// Uses the gear rolling hash CDC algorithm to find content-dependent
|
|
169
171
|
/// boundaries. Returns at least one chunk (empty slice for empty input).
|
|
170
172
|
/// When `utf32` is true, aligns cut points to 4-byte boundaries.
|
|
171
|
-
|
|
173
|
+
///
|
|
174
|
+
/// # Errors
|
|
175
|
+
///
|
|
176
|
+
/// Returns `IsccError::InvalidInput` if `avg_chunk_size < 2`. The mask
|
|
177
|
+
/// calculation requires `log2(avg_chunk_size) >= 1`.
|
|
178
|
+
pub fn alg_cdc_chunks(data: &[u8], utf32: bool, avg_chunk_size: u32) -> IsccResult<Vec<&[u8]>> {
|
|
179
|
+
if avg_chunk_size < 2 {
|
|
180
|
+
return Err(IsccError::InvalidInput(format!(
|
|
181
|
+
"avg_chunk_size must be >= 2, got {avg_chunk_size}"
|
|
182
|
+
)));
|
|
183
|
+
}
|
|
184
|
+
Ok(alg_cdc_chunks_unchecked(data, utf32, avg_chunk_size))
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/// Split data into content-defined chunks without validating `avg_chunk_size`.
|
|
188
|
+
///
|
|
189
|
+
/// Internal helper used by `DataHasher` and `gen_data_code_v0` where the
|
|
190
|
+
/// chunk size is always the validated constant `DATA_AVG_CHUNK_SIZE`.
|
|
191
|
+
pub(crate) fn alg_cdc_chunks_unchecked(
|
|
192
|
+
data: &[u8],
|
|
193
|
+
utf32: bool,
|
|
194
|
+
avg_chunk_size: u32,
|
|
195
|
+
) -> Vec<&[u8]> {
|
|
172
196
|
if data.is_empty() {
|
|
173
197
|
return vec![&data[0..0]];
|
|
174
198
|
}
|
|
@@ -242,7 +266,7 @@ mod tests {
|
|
|
242
266
|
|
|
243
267
|
#[test]
|
|
244
268
|
fn test_alg_cdc_chunks_empty() {
|
|
245
|
-
let chunks = alg_cdc_chunks(b"", false, 1024);
|
|
269
|
+
let chunks = alg_cdc_chunks(b"", false, 1024).unwrap();
|
|
246
270
|
assert_eq!(chunks.len(), 1);
|
|
247
271
|
assert_eq!(chunks[0].len(), 0);
|
|
248
272
|
}
|
|
@@ -251,7 +275,7 @@ mod tests {
|
|
|
251
275
|
fn test_alg_cdc_chunks_small_data() {
|
|
252
276
|
// Data smaller than min_size → one chunk containing all data
|
|
253
277
|
let data = vec![42u8; 100];
|
|
254
|
-
let chunks = alg_cdc_chunks(&data, false, 1024);
|
|
278
|
+
let chunks = alg_cdc_chunks(&data, false, 1024).unwrap();
|
|
255
279
|
assert_eq!(chunks.len(), 1);
|
|
256
280
|
assert_eq!(chunks[0].len(), 100);
|
|
257
281
|
}
|
|
@@ -260,7 +284,7 @@ mod tests {
|
|
|
260
284
|
fn test_alg_cdc_chunks_reassembly() {
|
|
261
285
|
// Chunks must reassemble to original data
|
|
262
286
|
let data: Vec<u8> = (0..=255).cycle().take(4096).collect();
|
|
263
|
-
let chunks = alg_cdc_chunks(&data, false, 1024);
|
|
287
|
+
let chunks = alg_cdc_chunks(&data, false, 1024).unwrap();
|
|
264
288
|
let reassembled: Vec<u8> = chunks.iter().flat_map(|c| c.iter().copied()).collect();
|
|
265
289
|
assert_eq!(reassembled, data);
|
|
266
290
|
}
|
|
@@ -268,8 +292,8 @@ mod tests {
|
|
|
268
292
|
#[test]
|
|
269
293
|
fn test_alg_cdc_chunks_deterministic() {
|
|
270
294
|
let data: Vec<u8> = (0..=255).cycle().take(4096).collect();
|
|
271
|
-
let chunks1 = alg_cdc_chunks(&data, false, 1024);
|
|
272
|
-
let chunks2 = alg_cdc_chunks(&data, false, 1024);
|
|
295
|
+
let chunks1 = alg_cdc_chunks(&data, false, 1024).unwrap();
|
|
296
|
+
let chunks2 = alg_cdc_chunks(&data, false, 1024).unwrap();
|
|
273
297
|
assert_eq!(chunks1.len(), chunks2.len());
|
|
274
298
|
for (a, b) in chunks1.iter().zip(chunks2.iter()) {
|
|
275
299
|
assert_eq!(a, b);
|
|
@@ -280,7 +304,7 @@ mod tests {
|
|
|
280
304
|
fn test_alg_cdc_chunks_multiple_chunks() {
|
|
281
305
|
// Large data produces multiple chunks
|
|
282
306
|
let data: Vec<u8> = (0..=255).cycle().take(8192).collect();
|
|
283
|
-
let chunks = alg_cdc_chunks(&data, false, 1024);
|
|
307
|
+
let chunks = alg_cdc_chunks(&data, false, 1024).unwrap();
|
|
284
308
|
assert!(
|
|
285
309
|
chunks.len() > 1,
|
|
286
310
|
"expected multiple chunks, got {}",
|
|
@@ -294,7 +318,7 @@ mod tests {
|
|
|
294
318
|
// Primary regression test for the infinite loop bug where
|
|
295
319
|
// cut_point % 4 == cut_point reduced cut_point to 0.
|
|
296
320
|
let data = [0xAA, 0xBB, 0xCC];
|
|
297
|
-
let chunks = alg_cdc_chunks(&data, true, 1024);
|
|
321
|
+
let chunks = alg_cdc_chunks(&data, true, 1024).unwrap();
|
|
298
322
|
assert!(!chunks.is_empty(), "must return at least one chunk");
|
|
299
323
|
let reassembled: Vec<u8> = chunks.iter().flat_map(|c| c.iter().copied()).collect();
|
|
300
324
|
assert_eq!(reassembled, data);
|
|
@@ -304,7 +328,7 @@ mod tests {
|
|
|
304
328
|
fn test_alg_cdc_chunks_utf32_exact_4_bytes() {
|
|
305
329
|
// Exactly 4 bytes with utf32=true must return one 4-byte chunk.
|
|
306
330
|
let data = [0x01, 0x02, 0x03, 0x04];
|
|
307
|
-
let chunks = alg_cdc_chunks(&data, true, 1024);
|
|
331
|
+
let chunks = alg_cdc_chunks(&data, true, 1024).unwrap();
|
|
308
332
|
assert_eq!(chunks.len(), 1);
|
|
309
333
|
assert_eq!(chunks[0], &data[..]);
|
|
310
334
|
}
|
|
@@ -313,7 +337,7 @@ mod tests {
|
|
|
313
337
|
fn test_alg_cdc_chunks_utf32_7_bytes() {
|
|
314
338
|
// 7 bytes (4+3) with utf32=true verifies non-aligned tail handling.
|
|
315
339
|
let data = [0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70];
|
|
316
|
-
let chunks = alg_cdc_chunks(&data, true, 1024);
|
|
340
|
+
let chunks = alg_cdc_chunks(&data, true, 1024).unwrap();
|
|
317
341
|
assert!(!chunks.is_empty(), "must return at least one chunk");
|
|
318
342
|
let reassembled: Vec<u8> = chunks.iter().flat_map(|c| c.iter().copied()).collect();
|
|
319
343
|
assert_eq!(reassembled, data);
|
|
@@ -325,7 +349,7 @@ mod tests {
|
|
|
325
349
|
// and all chunks except possibly the last must be 4-byte aligned.
|
|
326
350
|
let data: Vec<u8> = (0..=255).cycle().take(4096).collect();
|
|
327
351
|
assert_eq!(data.len() % 4, 0, "test data must be 4-byte aligned");
|
|
328
|
-
let chunks = alg_cdc_chunks(&data, true, 1024);
|
|
352
|
+
let chunks = alg_cdc_chunks(&data, true, 1024).unwrap();
|
|
329
353
|
let reassembled: Vec<u8> = chunks.iter().flat_map(|c| c.iter().copied()).collect();
|
|
330
354
|
assert_eq!(reassembled, data);
|
|
331
355
|
// All chunks except the last must be 4-byte aligned
|
|
@@ -344,8 +368,27 @@ mod tests {
|
|
|
344
368
|
#[test]
|
|
345
369
|
fn test_alg_cdc_chunks_utf32_empty() {
|
|
346
370
|
// Empty input with utf32=true must not loop and must return one empty chunk.
|
|
347
|
-
let chunks = alg_cdc_chunks(b"", true, 1024);
|
|
371
|
+
let chunks = alg_cdc_chunks(b"", true, 1024).unwrap();
|
|
348
372
|
assert_eq!(chunks.len(), 1);
|
|
349
373
|
assert_eq!(chunks[0].len(), 0);
|
|
350
374
|
}
|
|
375
|
+
|
|
376
|
+
#[test]
|
|
377
|
+
fn test_alg_cdc_chunks_zero_avg_chunk_size() {
|
|
378
|
+
let err = alg_cdc_chunks(b"hello", false, 0).unwrap_err();
|
|
379
|
+
assert!(err.to_string().contains("avg_chunk_size must be >= 2"));
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
#[test]
|
|
383
|
+
fn test_alg_cdc_chunks_one_avg_chunk_size() {
|
|
384
|
+
let err = alg_cdc_chunks(b"hello", false, 1).unwrap_err();
|
|
385
|
+
assert!(err.to_string().contains("avg_chunk_size must be >= 2"));
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
#[test]
|
|
389
|
+
fn test_alg_cdc_chunks_min_valid_avg_chunk_size() {
|
|
390
|
+
let chunks = alg_cdc_chunks(b"hello world", false, 2).unwrap();
|
|
391
|
+
let reassembled: Vec<u8> = chunks.iter().flat_map(|c| c.iter().copied()).collect();
|
|
392
|
+
assert_eq!(reassembled, b"hello world");
|
|
393
|
+
}
|
|
351
394
|
}
|
|
@@ -1,24 +1,31 @@
|
|
|
1
1
|
//! Conformance selftest for ISO 24138:2024 (ISCC).
|
|
2
2
|
//!
|
|
3
|
-
//! Runs
|
|
4
|
-
//! and reports pass/fail.
|
|
5
|
-
//! all
|
|
6
|
-
|
|
3
|
+
//! Runs gen functions against vendored conformance vectors from `data.json`
|
|
4
|
+
//! and reports pass/fail. Code types whose feature flags are disabled are
|
|
5
|
+
//! skipped (not failed). With all features enabled, all 9 gen functions are
|
|
6
|
+
//! tested. An application that claims ISCC conformance MUST pass all tests
|
|
7
|
+
//! in this suite.
|
|
8
|
+
|
|
9
|
+
#[cfg(feature = "meta-code")]
|
|
10
|
+
use crate::gen_meta_code_v0;
|
|
11
|
+
#[cfg(feature = "text-processing")]
|
|
12
|
+
use crate::gen_text_code_v0;
|
|
7
13
|
use crate::{
|
|
8
14
|
gen_audio_code_v0, gen_data_code_v0, gen_image_code_v0, gen_instance_code_v0, gen_iscc_code_v0,
|
|
9
|
-
|
|
15
|
+
gen_mixed_code_v0, gen_video_code_v0,
|
|
10
16
|
};
|
|
11
17
|
|
|
12
18
|
/// Embedded conformance test vectors (compile-time).
|
|
13
19
|
const TEST_DATA: &str = include_str!("../tests/data.json");
|
|
14
20
|
|
|
15
|
-
/// Run
|
|
21
|
+
/// Run conformance tests against vendored test vectors.
|
|
16
22
|
///
|
|
17
|
-
///
|
|
18
|
-
///
|
|
19
|
-
///
|
|
20
|
-
/// `
|
|
21
|
-
///
|
|
23
|
+
/// Tests each `gen_*_v0` function section in the conformance data, calling each
|
|
24
|
+
/// function with the specified inputs and comparing the `.iscc` field of the
|
|
25
|
+
/// result against expected output. Code types whose feature flags are disabled
|
|
26
|
+
/// are skipped. Returns `true` if all enabled tests pass, `false` if any
|
|
27
|
+
/// mismatch or error occurs. Does not panic — logs failures via `eprintln!`
|
|
28
|
+
/// and continues through all test cases.
|
|
22
29
|
pub fn conformance_selftest() -> bool {
|
|
23
30
|
let data: serde_json::Value = match serde_json::from_str(TEST_DATA) {
|
|
24
31
|
Ok(v) => v,
|
|
@@ -30,8 +37,14 @@ pub fn conformance_selftest() -> bool {
|
|
|
30
37
|
|
|
31
38
|
let mut passed = true;
|
|
32
39
|
|
|
33
|
-
|
|
34
|
-
|
|
40
|
+
#[cfg(feature = "meta-code")]
|
|
41
|
+
{
|
|
42
|
+
passed &= run_meta_tests(&data);
|
|
43
|
+
}
|
|
44
|
+
#[cfg(feature = "text-processing")]
|
|
45
|
+
{
|
|
46
|
+
passed &= run_text_tests(&data);
|
|
47
|
+
}
|
|
35
48
|
passed &= run_image_tests(&data);
|
|
36
49
|
passed &= run_audio_tests(&data);
|
|
37
50
|
passed &= run_video_tests(&data);
|
|
@@ -44,6 +57,7 @@ pub fn conformance_selftest() -> bool {
|
|
|
44
57
|
}
|
|
45
58
|
|
|
46
59
|
/// Run conformance tests for `gen_meta_code_v0`.
|
|
60
|
+
#[cfg(feature = "meta-code")]
|
|
47
61
|
fn run_meta_tests(data: &serde_json::Value) -> bool {
|
|
48
62
|
let mut passed = true;
|
|
49
63
|
let section = &data["gen_meta_code_v0"];
|
|
@@ -107,6 +121,7 @@ fn run_meta_tests(data: &serde_json::Value) -> bool {
|
|
|
107
121
|
}
|
|
108
122
|
|
|
109
123
|
/// Run conformance tests for `gen_text_code_v0`.
|
|
124
|
+
#[cfg(feature = "text-processing")]
|
|
110
125
|
fn run_text_tests(data: &serde_json::Value) -> bool {
|
|
111
126
|
let mut passed = true;
|
|
112
127
|
let section = &data["gen_text_code_v0"];
|