Open KimlikDAO-bot opened 8 months ago
We propose adding SHA512 to o1js. SHA512 is used in many applications, including but not limited to passports issued by certain countries (Brazil, Mexico, Finland, Türkiye) and various government ID cards.
The SHA512 algorithm employs 64-bit unsigned integers (u64) in its operations, which, it appears (https://github.com/o1-labs/o1js/issues/731#issuecomment-1810137079), can be implemented efficiently using the existing o1js functionality.
The basic interface, in line with the existing SHA256 interface, will be defined as:
interface SHA512 { hash(data: FlexibleBytes): Bytes; }
Later on, more specialized and optimized methods may be added for short byte arrays of length a multiple of 8.
We will add the following tests:
Yes please!!!
SHA512 in o1js
Overview
We propose adding SHA512 to o1js. SHA512 is used in many applications, including but not limited to passports issued by certain countries (Brazil, Mexico, Finland, Türkiye) and various government ID cards.
Implementation
The SHA512 algorithm employs 64-bit unsigned integers (u64) in its operations, which, it appears (https://github.com/o1-labs/o1js/issues/731#issuecomment-1810137079), can be implemented efficiently using the existing o1js functionality.
The basic interface, in line with the existing SHA256 interface, will be defined as:
Later on, more specialized and optimized methods may be added for short byte arrays of length a multiple of 8.
Testing
We will add the following tests: