⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 crypto.c

📁 又一个DDNS 的源码
💻 C
字号:
/* *	DDNS v3 Client * *		Author:		Alan Yates <alany@ay.com.au> *		Version:	$Id: crypto.c,v 1.1.1.1 2002/07/19 11:47:20 alany Exp $ */#define _XOPEN_SOURCE#ifdef WIN32#include <windows.h>#else#include <unistd.h>#endif#include <stdlib.h>#include <stdio.h>#include "md5.h"static char*hex(char *s, int len) {	int i;	char *buf = (char *) calloc((len * 2) + 1, sizeof(char));	for(i = 0; i < len; i++)		sprintf(&(buf[i*2]), "%.2x", s[i] & 0xff);	buf[len*2] = 0;	return buf;}char*ddns3_crypto_md5hash(char *s, int len) {        MD5_CTX context;        char *buf = (char *) calloc(MD5_DIGEST_CHARS, sizeof(char));        char *str = (char *) calloc(len, sizeof(char));        memcpy(str, s, len);        MD5Init(&context);        MD5Update(&context, str, len);        MD5Final(buf, &context);        free(str);	str = hex(buf, MD5_DIGEST_CHARS);	free(buf);        return str;}#ifndef WIN32char*ddns3_crypto_crypt(char *key, char *salt) {	char *buf = (char *) calloc(14, sizeof(char));		memcpy(buf, crypt(key, salt), 13);	buf[13] = 0;	return buf;}#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -