mirror of
https://github.com/versity/versitygw.git
synced 2026-01-06 19:56:27 +00:00
22 lines
574 B
Python
22 lines
574 B
Python
import sys
|
|
from awscrt import checksums
|
|
|
|
def get_call(checksum_type):
|
|
if checksum_type == "crc32c":
|
|
return checksums.crc32c
|
|
elif checksum_type == "crc64nvme":
|
|
return checksums.crc64nvme
|
|
sys.stderr.write("unrecognized checksum type " + checksum_type)
|
|
sys.exit(1)
|
|
|
|
def main():
|
|
if len(sys.argv) != 3:
|
|
sys.stderr.write('Checksum type, data file path required')
|
|
sys.exit(1)
|
|
with open(sys.argv[2], 'rb') as f:
|
|
function = get_call(sys.argv[1])
|
|
print(function(f.read()))
|
|
|
|
if __name__ == "__main__":
|
|
main()
|