-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #578 from thil4n/master
Add keccak_256 hashing
- Loading branch information
Showing
12 changed files
with
620 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Proposal: Introduce support for keccak-256 hashing in the Ballerina Crypto Module | ||
|
||
_Authors_: @thil4n | ||
_Reviewers_: | ||
_Created_: 2024/05/29 | ||
_Updated_: 2022/05/29 | ||
_Issue_: [#7509](https://github.com/ballerina-platform/ballerina-library/issues/7509) | ||
|
||
## Summary | ||
|
||
This proposal introduces support for the keccak-256 hashing algorithm in the Ballerina Crypto Module. The keccak-256 algorithm is a cryptographic hash function and a critical component of many blockchain systems, including Ethereum. Adding keccak-256 will expand the cryptographic capabilities of the Ballerina Crypto Module. | ||
|
||
## Goals | ||
|
||
- Provide support for the keccak-256 hashing algorithm in the Ballerina Crypto Module. | ||
|
||
## Motivation | ||
|
||
The Ballerina Crypto Module currently supports several hashing algorithms, such as SHA-256, SHA-512, and others. However, keccak-256, a widely-used cryptographic hash function, is not yet supported. This function is essential for blockchain applications, as it is the primary hashing algorithm in Ethereum. | ||
|
||
The lack of native support for keccak-256 requires developers to rely on external libraries or workarounds, which adds complexity and reduces the seamless integration of blockchain-related functionality in Ballerina. Adding native support for keccak-256 will address this gap and enhance Ballerina's suitability for blockchain-related projects. | ||
|
||
## Description | ||
|
||
This proposal adds keccak-256 hashing to the Ballerina Crypto Module. | ||
|
||
The key functionalities expected from this change are as follows, | ||
|
||
- API to retrieve the hash of the input with `crypto:hashKeccak256`. | ||
|
||
### API additions | ||
|
||
A new API will be added to retrieve the hash of the input with `crypto:hashKeccak256` | ||
|
||
```ballerina | ||
public isolated function hashKeccak256(byte[] input, byte[]? salt = ()) returns byte[]; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
.../bin/main/META-INF/native-image/io.ballerina.stdlib/crypto-native/native-image.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Copyright (c) 2022, WSO2 LLC. (https://www.wso2.com) All Rights Reserved. | ||
# | ||
# WSO2 LLC. licenses this file to you under the Apache License, | ||
# Version 2.0 (the "License"); you may not use this file except | ||
# in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
|
||
Args = --initialize-at-run-time=org.bouncycastle.jcajce.provider.drbg.DRBG\$Default \ | ||
--initialize-at-run-time=org.bouncycastle.jcajce.provider.drbg.DRBG\$NonceAndIV \ | ||
--features=io.ballerina.stdlib.crypto.svm.BouncyCastleFeature |
Oops, something went wrong.