blockchain-test/test/main.cpp

31 lines
No EOL
648 B
C++

#include <iostream>
#include <sstream>
#include <openssl/sha.h>
#include "../base58.h"
class Entity{
float x,y;
public:
void move(float ax,float ay){
x +=ax;
y += ay;
}
Entity(){
y = x = 0;
}
};
int main(){
SHA256_CTX sha;
SHA256_Init(&sha);
unsigned char md[SHA256_DIGEST_LENGTH];
Entity e;
SHA256_Update(&sha,&e, sizeof(Entity));
SHA256_Final(md,&sha);
std::stringstream ss;
for(int i = 0; i < SHA256_DIGEST_LENGTH; i++)
ss << std::hex << (int)md[i];
std::cout << ss.str() << std::endl;
std::cout << base58::encode("cat") << std::endl;
return 0;
}