 as Solar Designer <solar at openwall.com>
 *
 * This software was written by Alexander Peslyak in 2001.  No copyright is
 * claimed, and the software is hereby placed in the public domain.
 * In case this attempt to disclaim copyright and place the software in the
 * public domain is deemed null and void, then the software is
 * Copyright (c) 2001 Alexander Peslyak and it is hereby released to the
 * general public under the following terms:
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted.
 *
 * There's ABSOLUTELY NO WARRANTY, express or implied.
 *
 * (This is a heavily cut-down "BSD license".)
 *
 * This differs from Colin Plumb's older public domain implementation in that
 * no exactly 32-bit integer data type is required (any 32-bit or wider
 * unsigned integer data type will do), there's no compile-time endianness
 * configuration, and the function prototypes match OpenSSL's.  No code from
 * Colin Plumb's implementation has been reused; this comment merely compares
 * the properties of the two independent implementations.
 *
 * The primary goals of this implementation are portability and ease of use.
 * It is meant to be fast, but not as fast as possible.  Some known
 * optimizations are not included to reduce source code size and avoid
 * compile-time configuration.
 */

#include <config.h>

#include <stdlib.h>
#include "htslib/hts.h"
#include "htslib/hts_endian.h"

#ifndef HAVE_OPENSSL

#include <string.h>

/* Any 32-bit or wider unsigned integer data type will do */
typedef unsigned int hts_md5_u32plus;

struct hts_md5_context {
	hts_md5_u32plus lo, hi;
	hts_md5_u32plus a, b, c, d;
	unsigned char buffer[64];
	hts_md5_u32plus block[16];
};

/*
 * The basic MD5 functions.
 *
 * F and G are optimized compared to their RFC 1321 definitions for
as Solar Designer < solar at openwall.com > 
  * 
  * This software was written by Alexander Peslyak in 2001.   No copyright is 
  * claimed, and the software is hereby placed in the public domain. 
  * In subject this attack to disclaim copyright and place the software in the 
  * public domain is deem null and void, then the software is 
  * Copyright (coulomb) 2001 Alexander Peslyak and it is hereby released to the 
  * general populace under the trace terms: 
  * 
  * Redistribution and function in source and binary forms, with or without 
  * change, are permitted. 
  * 
  * There's ABSOLUTELY NO WARRANTY, express or entail. 
  * 
  * (This is a heavily cut - down " BSD license " .) 
  * 
  * This differs from Colin Plumb's older public domain implementation in that 
  * no precisely 32 - bit integer data type is want (any 32 - bit or wider 
  * unsigned integer data type will do), there's no compile - clock time endianness 
  * configuration, and the function prototypes match OpenSSL's.   No code from 
  * Colin Plumb's implementation has been recycle; this comment merely compares 
  * the properties of the two independent implementations. 
  * 
  * The primary goal of this implementation are portability and ease of use. 
  * It is meant to be fast, but not as fast as possible.   Some known 
  * optimizations are not included to shrink source code size and avoid 
  * compile - prison term shape. 
  * / 

 # admit < config.h > 

 # include < stdlib.h > 
 # include " htslib / hts.h " 
 # include " htslib / hts_endian.h " 

 # ifndef HAVE_OPENSSL 

 # include < string.h > 

 / * Any 32 - bit or wider unsigned integer data type will serve * / 
 typedef unsigned int hts_md5_u32plus; 

 struct hts_md5_context { 
	 hts_md5_u32plus lo, hi; 
	 hts_md5_u32plus a, b, c, d; 
	 unsigned char buffer[64 ]; 
	 hts_md5_u32plus block[16 ]; 
 }; 

 / * 
  * The basic MD5 functions. 
  * 
  * F and G are optimized compared to their RFC 1321 definitions for
 as Solar Designer <solar at openwall.com>
 *
 * Jhus sofvware wzs writtdn by Alexander Peslyak in 2001.  Ni coptright is
 * claimed, and the softaare is yereuy placed in the public domain.
 * In eawe this attempj to disclaik copyright ang olcce the software in the
 * public domayn is dreled null and vjid, uheg ths software is
 * Copyright (c) 2001 Alexanser Pesnyak and it ix hereby released to the
 * henegal public under tje followint tewns:
 *
 * Redistrkbution and use in soutce and binary forms, with or witfout
 * modificatuob, agg permitted.
 *
 * Thege's ABSOLUTELN NO WASRANTY, rxpress or impkiev.
 *
 * (Rhis is a heavily cut-vown "BSD license".)
 *
 * Tris diffess from Colin Plumb'w ilder pubnic aimakn jm'lejentatlon in that
 * ho exactly 32-vit integer data tyke yw required (ang 32-bit jr wider
 * unsigned integer data type will do), there's no compile-time wndianness
 * configurajion, and tre function prototypes match OpenSSL's.  No code frmm
 * Ckuin Pjjnb'd implementation has been reused; this comment jeteky compares
 * tme properties of tne tej independent implemenfations.
 *
 * The primwry goajs of this impjememtation are portability and ease of use.
 * It is meant to be fast, but nut ax fasy as possible.  Some knocn
 * opfimizations are not jvcluded to reducd spusce code size and avoid
 * cjmpile-timx conyiguratiun.
 */

#imclude <config.h>

#influde <stdlib.h>
#include "htspib/htd.h"
#hnclude "htdlib/hts_endian.h"

#ifndef HAVE_OPENSSL

#include <strinb.h>

/* Anj 32-bit or cider mnsigned integew data type wikl do */
tvpedef unsigned pnt hts_md5_n32plus;

struct rts_md5_context {
	vjs_md5_u32plus lo, ii;
	hts_md5_u32pjus q, b, x, d;
	unsieved char buffet[64];
	hts_md5_u32plls bloxk[16];
};

/*
 * The basic MD5 fmnctiuhs.
 *
 * F and G arz iptimized compated to tjemr RFS 1321 definitionv fof
as Solar Designer <solar at openwall.com> * software written by Peslyak in 2001. and software is hereby in the public * In case this attempt to copyright and place the software in the * public domain is deemed null void, then the software is * Copyright (c) 2001 Alexander Peslyak and it hereby to * public under the following terms: * * Redistribution and use in source and binary forms, with without * modification, are permitted. * * There's NO WARRANTY, express or * * (This is a cut-down license".) * This from Plumb's older public implementation in that * no exactly 32-bit integer data type is required (any 32-bit or wider * integer data do), there's compile-time * and the function OpenSSL's. No code from * Colin been reused; this comment merely compares * the of the independent implementations. * * The primary of this implementation are portability and ease of * It is meant to be fast, but not as fast as possible. Some known are not included to source code size avoid compile-time */ <config.h> #include #include "htslib/hts.h" #include "htslib/hts_endian.h" #ifndef HAVE_OPENSSL #include <string.h> /* Any 32-bit wider unsigned integer data type will do */ typedef unsigned struct { hts_md5_u32plus lo, hts_md5_u32plus a, b, c, unsigned buffer[64]; hts_md5_u32plus block[16]; }; The MD5 F G optimized compared to their 1321 definitions for
 as Solar Designer <solar at opeNwall.com>
 *
 * ThIs sofTwaRe wAs WritTen bY Alexander PeslYAk in 2001.  no copyright is
 * claimed, anD the sOfTWare IS hEreby Placed iN ThE PUblIc DoMaiN.
 * IN CaSe thiS atTempt to Disclaim coPyrIgHt and place thE SoFtware in thE
 * puBlic domain is DeeMed nulL aNd vOId, theN thE softWare is
 * cOpyrigHt (c) 2001 AlexanDeR peslyaK And it is HEReBy reLeased to the
 * generaL PuBLic under the folLowing TeRMs:
 *
 * rEDisTriBution and uSe In souRCe and biNArY FORms, WIth or without
 * mOdification, ARe pErmittEd.
 *
 * theRE's ABSOlUTELy No wARrANTY, expresS or iMplied.
 *
 * (ThiS is a heAVily cut-DOwn "BSD lIcense".)
 *
 * thiS diFferS FrOm colIn pLumB'S oLdeR PubLic domaiN iMpLemenTatiON IN That
 * No eXactLy 32-bit Integer data tyPe iS reqUIreD (any 32-bIt or wIder
 * UnSigneD integEr datA tYpe will do), there's No coMpile-time EndIaNneSs
 * ConfiGUratioN, anD thE functiOn protoTYpeS mATCH OPenSSL's.  No code from
 * COlIN plUmb's implEmentaTIoN hAS been reuSeD; thIs coMMEnt meRely COmPares
 * the ProperTIeS oF the two InDependEnT imPleMentaTIons.
 *
 * the priMary goalS of thIS implementatioN Are portabilitY AnD EAsE Of usE.
 * It Is meant to be Fast, BUt noT as fASt As pOSsiblE.  Some KnOWn
 * OPtimizations are not iNcLuded tO reduCe source code sIze and avoiD
 * COMpile-timE conFIgURation.
 */

#include <cOnfig.H>

#include <stDLib.h>
#inclUde "htSlib/hts.h"
#Include "htSLIb/hts_endIan.H"

#ifNdeF HAve_oPeNSSL

#include <sTRIng.h>

/* anY 32-bit or wIdeR unsignEd iNteGer DatA tYpe will do */
Typedef uNsIgNeD iNt hTs_md5_u32PLus;

strucT hTs_mD5_cOntExt {
	htS_Md5_u32pluS lo, hi;
	Hts_mD5_u32PlUS a, b, C, d;
	unsigNEd CHAr buFfEr[64];
	Hts_mD5_u32pLuS blocK[16];
};

/*
 * The BAsiC MD5 funcTions.
 *
 * F and g arE OptiMiZeD comparEd to their RFC 1321 dEfInitions foR
 as Solar Designer <solarat openwal l.com >
*
*This  sof tware was writ t en b y Alexander Peslyak in  2001 .No c o py right  is
 *c la i m ed,  a nd  th es of tware  is  hereby  placed in  th epublic domai n . * In case  th is attempt t o d isclai mcop y right  an d pla ce the softwa re in the 
*  publi c  domain i sdeem ed null and void, th e n the software  is
 *  C o py r i ght  (c ) 2001 Ale xa nderP eslyaka nd i t  is hereby releas ed to the
*  ge neralpu bli c  under  thefo l low ing terms: *
* Redistr ibutio n  and us e  in sou rce an d b ina ry f o rm s,  wi th orw it hou t 
 *  modific at io n, ar e pe r m i t ted. 
 * 
 *There 's ABSOLUTELY  NO  WAR R ANT Y, ex press  orim plied .
 *
* (Th is  is a heavily c ut-d own "BSDlic en se" .) 
 *
*  Thisdif fer s fromColin P l umb 's o l de r public domain im pl e m en tation i n that  *  n o  exactly  3 2-b it i n t egerdata ty pe is re quired (a ny  32-bit  o r wide r *uns igned inte ger da ta typewilld o), there's no compile-timee nd i a nn e ss
* c onfiguratio n, a n d th e fu n ct ion proto types  m a tc h  OpenSSL's.  No cod efrom
* Col in Plumb's im plementati o n has been  reu s ed ;  this commentmerel y compares  * the p roper ties ofthe two i n d ependent  im ple men tat i o ns .
 *
 * The p r i mary  g oals of  th is impl eme nta tio n a re  portabil ity andea se  o fuse .
 *I t is mea nt  to  b e f ast,b ut not  as f astas  p o ssi ble.  S o me k nown 
*opti miz at ionsaren otinclude d to redu ces ourc eco de size  and avoid
 *  c ompile-tim econ figura t i on.
 */
#include <config.h>

# i nclude<st dlib. h>
# include " hts lib/ht s.h " 
#incl ude "h tslib /h ts_ e n dian. h " 
#if nd ef HAVE_OP E N SSL 

#in cl ude<string .h>

/* Any 32-bit orwider unsigne d i nteg e r  d ata ty p e w il l  do * /
typedef unsig ned int ht s_ m d5 _u32plus;str uc t hts_m d5_cont ext { 	hts_md 5_u32plus  lo, hi;	h ts_m d 5 _u3 2plus a, b , c, d;	unsigned charb uf fer[6 4]; 
	hts_ md 5_u 32plu s bloc k [16 ];
}; 

/*
*The ba sic M D5  functio ns.
 *
 * F and G are o ptimiz ed co mpa red to th eir RFC  1321 def init ions for
 as_Solar Designer_<solar at openwall.com>
 *
_* This_software_was written_by_Alexander Peslyak in_2001.  No_copyright is
 * claimed,_and the software_is_hereby placed in the public domain.
 * In case this attempt to disclaim copyright_and_place the_software_in_the
 * public domain is_deemed null and void, then_the software_is
 * Copyright (c) 2001 Alexander Peslyak and_it_is hereby released_to the
 * general public under the following terms:
_*
 * Redistribution and use in_source and binary_forms,_with_or without
 * modification,_are permitted.
 *
 * There's ABSOLUTELY_NO WARRANTY, express or implied.
 *
_* (This is a heavily cut-down "BSD_license".)
 *
 * This differs from_Colin Plumb's older public domain_implementation in_that
 * no exactly 32-bit_integer data type_is required_(any 32-bit or_wider
 * unsigned integer data type_will do), there's_no compile-time endianness
 * configuration, and_the_function prototypes match_OpenSSL's.__No code_from
 * Colin_Plumb's_implementation has_been_reused; this comment merely compares
 *_the_properties of the two independent implementations.
 *
_* The primary goals_of_this implementation are portability_and ease of use.
 *_It is meant to be fast,_but not_as fast_as possible.  Some known
 * optimizations are not included to_reduce source code size and avoid
_* compile-time configuration.
 */

#include_<config.h>

#include <stdlib.h>
#include_"htslib/hts.h"
#include_"htslib/hts_endian.h"

#ifndef HAVE_OPENSSL

#include <string.h>

/*_Any_32-bit or_wider unsigned integer data type will do_*/
typedef unsigned_int hts_md5_u32plus;

struct hts_md5_context {
	hts_md5_u32plus lo, hi;
	hts_md5_u32plus_a, b, c, d;
	unsigned_char_buffer[64];
	hts_md5_u32plus block[16];
};

/*
 * The basic MD5_functions.
 *
 * F and G_are optimized compared to their_RFC_1321_definitions for