Created
December 4, 2015 15:27
-
-
Save jimfinnis/8bdcef83ee6c32be1dc3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @file advent.cpp | |
* @brief Brief description of file. | |
* | |
*/ | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <angort/angort.h> | |
#include "md5.h" | |
using namespace angort; | |
%name advent | |
%shared | |
%wordargs md5 s (str -- str) | |
{ | |
unsigned int len = strlen(p0); | |
unsigned char out[16]; | |
MD5_CTX mdContext; | |
MD5_Init (&mdContext); | |
MD5_Update (&mdContext,p0, len); | |
MD5_Final (out,&mdContext); | |
char buf[33];buf[0]=0; | |
for(int i=0;i<16;i++) | |
sprintf(buf+strlen(buf),"%02x",out[i]); | |
a->pushString(buf); | |
} | |
%init | |
{ | |
fprintf(stderr,"Initialising ADVENT plugin, %s %s\n",__DATE__,__TIME__); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment