30 lines
No EOL
591 B
C++
30 lines
No EOL
591 B
C++
#include <iostream>
|
|
#include <cstring>
|
|
#include <sstream>
|
|
#include <openssl/sha.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;
|
|
return 0;
|
|
} |