<commit_before>#include <iostream>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <openssl/sha.h>
#include <iomanip>
#include <sstream>
#define MAX_SIZE 256
using namespace std; 
string print_hex(unsigned char *bs, unsigned int n) {
    string ret_val = "";
    for (int i = 0; i < n; i++) {
        stringstream ss;
        ss << hex << static_cast<int>(bs[i]);
        ret_val += ss.str();
    }
    return ret_val;
}
int main(int argc, char ** argv) {
    if ( argc != 2 ) {
        cerr << "Usage: " << argv[0] << " <string>" << endl;
        exit(EXIT_FAILURE);
    }
    char * tmp = new char[MAX_SIZE];
    unsigned char temp[SHA512_DIGEST_LENGTH];
 	strncpy(tmp, argv[1], MAX_SIZE);
    memset(temp, 0x0, SHA512_DIGEST_LENGTH);
    SHA512((unsigned char *)argv[1], strlen(argv[1]), temp);
    cout << "SHA512 of " << tmp << " is " << print_hex(temp, sizeof(temp)) << endl;
    return 0;
}
<commit_msg>added credit where credit is due<commit_after>#include <iostream>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <openssl/sha.h>
#include <iomanip>
#include <sstream>
#define MAX_SIZE 256
using namespace std; 
// https://memset.wordpress.com/2010/10/06/using-sha1-function/
// http://stackoverflow.com/questions/11765522/how-do-i-write-this-in-cout-c
string print_hex(unsigned char *bs, unsigned int n) {
    string ret_val = "";
    for (int i = 0; i < n; i++) {
        stringstream ss;
        ss << hex << static_cast<int>(bs[i]);
        ret_val += ss.str();
    }
    return ret_val;
}
int main(int argc, char ** argv) {
    if ( argc != 2 ) {
        cerr << "Usage: " << argv[0] << " <string>" << endl;
        exit(EXIT_FAILURE);
    }
    char * tmp = new char[MAX_SIZE];
    unsigned char temp[SHA512_DIGEST_LENGTH];
 	strncpy(tmp, argv[1], MAX_SIZE);
    memset(temp, 0x0, SHA512_DIGEST_LENGTH);
    SHA512((unsigned char *)argv[1], strlen(argv[1]), temp);
    cout << "SHA512 of " << tmp << " is " << print_hex(temp, sizeof(temp)) << endl;
    return 0;
}

{'fraction_non_alphanumeric': 0.17227722772277226, 'fraction_numerical': 0.03217821782178218, 'mean_word_length': 3.245798319327731, 'pattern_counts': {'":': 0, '<': 67, '<?xml version=': 0, '>': 21, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4705543', 'n_tokens_mistral': 779, 'n_tokens_neox': 729, 'n_words': 181}