2 * @file purple-digest.c
6 * Copyright (C) 2010 SIPE Project <http://sipe.sourceforge.net/>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 #include "sipe-backend.h"
28 static void purple_digest(const gchar
*algorithm
,
29 const guchar
*data
, gsize data_length
,
30 guchar
*digest
, gsize digest_length
)
32 PurpleCipherContext
*ctx
= purple_cipher_context_new_by_name(algorithm
, NULL
);
33 purple_cipher_context_append(ctx
, data
, data_length
);
34 purple_cipher_context_digest(ctx
, digest_length
, digest
, NULL
);
35 purple_cipher_context_destroy(ctx
);
38 void sipe_backend_digest_md4(const guchar
*data
, gsize length
, guchar
*digest
)
40 purple_digest("md4", data
, length
, digest
, SIPE_DIGEST_MD4_LENGTH
);
43 void sipe_backend_digest_md5(const guchar
*data
, gsize length
, guchar
*digest
)
45 purple_digest("md5", data
, length
, digest
, SIPE_DIGEST_MD5_LENGTH
);
48 void sipe_backend_digest_sha1(const guchar
*data
, gsize length
, guchar
*digest
)
50 purple_digest("sha1", data
, length
, digest
, SIPE_DIGEST_SHA1_LENGTH
);