mirror of
https://github.com/justinian/jsix.git
synced 2025-12-09 16:04:32 -08:00
[boot] More initrd format changes
CDB seemed to be too simple for the needs of init, and squashfs is too laden with design choices to work around Linux's APIs. This commit adds creation of an initrd image of a new format I've called `j6romfs`. Note that this commit currently does not work! The initrd-reading code still needs to be added.
This commit is contained in:
17
scripts/fnv.py
Normal file
17
scripts/fnv.py
Normal file
@@ -0,0 +1,17 @@
|
||||
"""Python implementation of FNV hashes."""
|
||||
|
||||
_FNV1_prime32 = 16777619
|
||||
_FNV1_prime64 = 1099511628211
|
||||
_FNV1_offset32 = 2166136261
|
||||
_FNV1_offset64 = 14695981039346656037
|
||||
|
||||
def _fnv1a(offset, prime, mask):
|
||||
def hashfunc(data):
|
||||
h = offset
|
||||
for b in data:
|
||||
h = ((h ^ b) * prime) & mask
|
||||
return h
|
||||
return hashfunc
|
||||
|
||||
hash64 = _fnv1a(_FNV1_offset64, _FNV1_prime64, (2**64)-1)
|
||||
hash32 = _fnv1a(_FNV1_offset32, _FNV1_prime32, (2**32)-1)
|
||||
Reference in New Issue
Block a user