Spin out a std/adler32 package

This commit is contained in:
Nigel Tao committed 2018-04-27 17:20:10 +10:00
1 parent 977f1fe64d
commit 035b138cb1
13 files changed
+3189 -319

No files matched your search

+5
View File
@@ -0,0 +1,5 @@
# Adler32
Adler32 is a checksum algorithm that hashes byte sequences to 32 bit values.
TODO: a worked example.
@@ -12,13 +12,15 @@
// See the License for the specific language governing permissions and
// limitations under the License.
// TODO: drop the '?' but still generate wuffs_zlib__adler32__initialize?
pri struct adler32?(
packageid "adl3"
// TODO: drop the '?' but still generate wuffs_adler32__hasher__initialize?
pub struct hasher?(
state base.u32 = 1,
)
// TODO: add a ! as this function is impure.
pri func adler32.update(x slice base.u8)(checksum base.u32) {
pub func hasher.update(x slice base.u8)(checksum base.u32) {
// The Adler-32 checksum's magic 65521 and 5552 numbers are discussed in
// RFC 1950.
+2 -1
View File
@@ -14,6 +14,7 @@
packageid "zlib"
use "std/adler32"
use "std/deflate"
pub error "checksum mismatch"
@@ -25,7 +26,7 @@ pub error "TODO: unsupported zlib preset dictionary"
pub struct decoder?(
flate deflate.decoder,
checksum adler32,
checksum adler32.hasher,
ignore_checksum base.bool,
)