Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/makarov-danil-school-projects-ctu/cryptography-sha-512
https://github.com/makarov-danil-school-projects-ctu/cryptography-sha-512
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/makarov-danil-school-projects-ctu/cryptography-sha-512
- Owner: Makarov-Danil-School-Projects-CTU
- Created: 2024-08-13T12:10:41.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2024-08-13T21:15:34.000Z (5 months ago)
- Last Synced: 2024-08-14T15:04:40.327Z (5 months ago)
- Language: C++
- Size: 6.84 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Keywords: C++, Open SSL, Hash functions
# 📝 Task Objective:
Your task is to implement a function (or a set of functions, not a full program) that finds any message whose hash (SHA-512) starts with a specified sequence of zero bits from the left.
The bit order is big-endian: Byte 0 from MSB to LSB, Byte 1 from MSB to LSB, ..., last byte from MSB to LSB.
In other words, two zero bits correspond to a byte like 0010 0111 (0x27).The function is required in two variants:
1. Basic solution (findHash function). The implementation of this function is mandatory.
2. Enhanced solution (findHashEx function). The implementation of this function is optional, but a dummy implementation must be provided to compile the task. Implement this function if you aim for a bonus.#### 📥 Function Parameters:
```
int findHash(int bits, string &message, string &hash)
```- **bits:** The required number of zero bits in the hash of the message.
- **message:** Output parameter. This parameter will contain the data for which the corresponding hash was found. The result is stored as a hexadecimal string.
- **hash:** Output parameter. This is the hash of the message from the previous parameter, also stored as a hexadecimal string.
- **Return value:** The function returns 1 on success, 0 on failure or invalid parameters (typically, an unreasonable number of zero bits).```
int findHashEx(int bits, string &message, string &hash, string_view hashFunction)
```- Extension of findHash: All parameters and return value remain the same as in the basic variant.
- **hashFunction:** A new parameter that specifies which hash function should be used to find the sequence of zero bits. The provided hash function name must be compatible with EVP_get_digestbyname.