Skip to content
/ md5 Public
forked from ulwanski/md5

Functions to create MD5 checksum from file or string

Notifications You must be signed in to change notification settings

spencexu/md5

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 

Repository files navigation

md5

Class to create MD5 checksum from file or string

Example

#include "md5/md5.h"

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

  char cstring[] = "Foo baz, testing.";
  std::string str = cstring;

  /* MD5 from std::string */
  printf("md5sum: %s\n",  md5(  str ).c_str());
  
  /* MD5 from c-string */
  printf("md5sum: %s\n",  md5(  cstring ).c_str());
  
  /* Short MD5 from c-string */
  printf("md5sum6: %s\n", md5sum6( cstring ).c_str());
  
  /* Short MD5 from std::string */
  printf("md5sum6: %s\n", md5sum6( str ).c_str());
  
  /* MD5 from filename */
  printf("md5file: %s\n", md5file("README.md").c_str());
  
  /* MD5 from opened file */
  std::FILE* file = std::fopen("README.md", "rb");
  printf("md5file: %s\n", md5file(file).c_str());
  std::fclose(file);

  /* we're done */
  return EXIT_SUCCESS;
}

Compilation in g

g -std=c 0x -o md5 md5.cpp main.cpp

About

Functions to create MD5 checksum from file or string

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 100.0%