Просмотр полной версии : Реализация MD5 RFC 1321
Есть где нибудь портированый алгоритм http://ubiqx.org/libcifs/source/Auth/MD5.c , с функцией md5_sum (md5SumCtx) ? Просто если уже есть реализация портировать не буду ,нету - придется время тратить , может кто сталкивался?
Aquahawk
14.09.2011, 12:07
http://www.flasher.ru/forum/blog.php?b=203
http://www.flasher.ru/forum/blog.php?b=203
Там реализация через строки , а мне ba реализация нужна с функцией sum , погуглил ничего подобного не нашел...
Aquahawk
14.09.2011, 12:25
Смотрите внимательнее, есть там байтарраи.
by.blooddy.crypto.MD5.hashBytes( bytes );
Если хотите добавить байтарраю sum то снаследуйтесь и вызовите эту библиотеку. Я её прекрасно использую именно с байтарраями
hashBytes(bytes) : String!
uchar *auth_md5Sum( uchar *dst, const uchar *src, const int len )
/* ------------------------------------------------------------------------ **
* Compute an MD5 message digest.
*
* Input: dst - Destination buffer into which the result will be written.
* Must be 16 bytes, minimum.
* src - Source data block to be MD5'd.
* len - The length, in bytes, of the source block.
* (Note that the length is given in bytes, not bits.)
*
* Output: A pointer to <dst>, which will contain the calculated 16-byte
* MD5 message digest.
*
* Notes: This function is a shortcut. It takes a single input block.
* For more drawn-out operations, see <auth_md5InitCtx()>.
*
* This function is interface-compatible with the
* <auth_md4Sum()> function in the MD4 module.
*
* The MD5 algorithm is designed to work on data with an
* arbitrary *bit* length. Most implementations, this one
* included, handle the input data in byte-sized chunks.
*
* The MD5 algorithm does much of its work using four-byte
* words, and so can be tuned for speed based on the endian-ness
* of the host. This implementation is intended to be
* endian-neutral, which may make it a teeny bit slower than
* others. ...maybe.
*
* See Also: <auth_md5InitCtx()>
*
* ------------------------------------------------------------------------ **
*/
{
auth_md5Ctx ctx[1];
(void)auth_md5InitCtx( ctx ); /* Open a context. */
(void)auth_md5SumCtx( ctx, src, len ); /* Pass only one block. */
(void)auth_md5CloseCtx( ctx, dst ); /* Close the context. */
return( dst ); /* Makes life easy. */
} /* auth_md5Sum */
Я правильно поминаю ,что в данном случае hashBytes(bytes) , вернет тоже самое ,только в строковом представлении?
Работает на vBulletin ® версия 3.7.3. Copyright ©2000-2026, Jelsoft Enterprises Ltd. Перевод: zCarot
Copyright © 1999-2008 Flasher.ru. All rights reserved.