Click here to Skip to main content
15,868,141 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
C++
#include <iostream>
#include <chrono>
#include <ctime>
#include "SHA256.h"

int main(int argc, char** argv) {

	for (int i = 1; i < argc; i++) {
		SHA256 sha;
		sha.update(argv[i]);
		uint8_t* digest = sha.digest();

		std::cout << SHA256::toString(digest) << std::endl;

		delete[] digest;
	}

	return EXIT_SUCCESS;
}


What I have tried:

I am looking for c++ to c converter.
Posted
Updated 5-Jun-23 11:39am
v2

C++ is a superset of C, so 90% of that code is already in C - the cout stuff needs to be replaced by printf statements is all.

But ... first you will have to find an SHA-256 C library that you can use, as it's not a part of standard C at all. Google is the place to start: sha256 c library - Google Search[^]
 
Share this answer
 
There is no converter. You have to rewrite the code from scratch, by understanding what the original code does and writing equivalent code in C.

No, nobody is going to that for you.
 
Share this answer
 
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900