linux c/c++ 后台开发常用算法之:md5算法c++版实现

C++ 计算某个文件的 MD5 网上截取的代码片段,备用工具 阅读详情

MD5即Message-Digest Algorithm 5(消息摘要算法第五版)的简称,是当前计算机领域用于确保信息传输完整一致而广泛使用的散列算法之一(又译哈希算法、摘要算法等),主流编程语言普遍已有MD5的实现。将数据(如一段文字)运算变为另一固定长度值,是散列算法的基础, 下面是c++版的MD5算法实现。

#ifndef MD5_H
#define MD5_H

#include <string.h>
#include <string>
#include <fstream>

/* Type define */
typedef unsigned char byte;
typedef unsigned long ulong;

using std::string;
using std::ifstream;

/* MD5 declaration. */
class MD5 {
public:
	MD5();
	MD5(const void *input, size_t length);
	MD5(const string &str);
	MD5(ifstream &in);
	void update(const void *input, size_t length);
	void update(const string &str);
	void update(ifstream &in);
	const byte* digest();
	string toString();
	void reset();
private:
	void update(const byte *input, size_t length);
	void final();
	void transform(const byte block[64]);
	void encode(const ulong *input, byte *output, size_t length);
	void decode(const byte *input, ulong *output, size_t length);
	string bytesToHexString(const byte *input, size_t length);

	/* class uncopyable */
	MD5(const MD5&);
	MD5& operator=(const MD5&);
private:
	ulong _state[4];	/* state (ABCD) */
	ulong _count[2];	/* number of bits, modulo 2^64 (low-order word first) */
	byte _buffer[64];	/* input buffer */
	byte _digest[16];	/* message digest */
	bool _finished;		/* calculate finished ? */

	static const byte PADDING[64];	/* padding for calculate */
	static const char HEX[16];
	static const size_t BUFFER_SIZE = 1024;
};

#endif/*MD5_H*/
#include "md5.h"

using namespace std;

/* Constants for MD5Transform routine. */
#define S11 7
#define S12 12
#define S13 17
#define S14 22
#define S21 5
#define S22 9
#define S23 14
#define S24 20
#define S31 4
#define S32 11
#define S33 16
#define S34 23
#define S41 6
#define S42 10
#define S43 15
#define S44 21


/* F, G, H and I are basic MD5 functions.
*/
#define F(x, y, z) (((x) & (y)) | ((~x) & (z)))
#define G(x, y, z) (((x) & (z)) | ((y) & (~z)))
#define H(x, y, z) ((x) ^ (y) ^ (z))
#define I(x, y, z) ((y) ^ ((x) | (~z)))

/* ROTATE_LEFT rotates x left n bits.
*/
#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))

/* FF, GG, HH, and II transformations for rounds 1, 2, 3, and 4.
Rotation is separate from addition to prevent recomputation.
*/
#define FF(a, b, c, d, x, s, ac) { \
	(a) += F ((b), (c), (d)) + (x) + ac; \
	(a) = ROTATE_LEFT ((a), (s)); \
	(a) += (b); \
}
#define GG(a, b, c, d, x, s, ac) { \
	(a) += G ((b), (c), (d)) + (x) + ac; \
	(a) = ROTATE_LEFT ((a), (s)); \
	(a) += (b); \
}
#define HH(a, b, c, d, x, s, ac) { \
	(a) += H ((b), (c), (d)) + (x) + ac; \
	(a) = ROTATE_LEFT ((a), (s)); \
	(a) += (b); \
}
#define II(a, b, c, d, x, s, ac) { \
	(a) += I ((b), (c), (d)) + (x) + ac; \
	(a) = ROTATE_LEFT ((a), (s)); \
	(a) += (b); \
}


const byte MD5::PADDING[64] = { 0x80 };
const char MD5::HEX[16] = {
	'0', '1', '2', '3',
	'4', '5', '6', '7',
	'8', '9', 'a', 'b',
	'c', 'd', 'e', 'f'
};

/* Default construct. */
MD5::MD5() {
	reset();
}

/* Construct a MD5 object with a input buffer. */
MD5::MD5(const void *input, size_t length) {
	reset();
	update(input, length);
}

/* Construct a MD5 object with a string. */
MD5::MD5(const string &str) {
	reset();
	update(str);
}

/* Construct a MD5 object with a file. */
MD5::MD5(ifstream &in) {
	reset();
	update(in);
}

/* Return the message-digest */
const byte* MD5::digest() {
	if (!_finished) {
		_finished = true;
		final();
	}
	return _digest;
}

/* Reset the calculate state */
void MD5::reset() {

	_finished = false;
	/* reset number of bits. */
	_count[0] = _count[1] = 0;
	/* Load magic initialization constants. */
	_state[0] = 0x67452301;
	_state[1] = 0xefcdab89;
	_state[2] = 0x98badcfe;
	_state[3] = 0x10325476;
}

/* Updating the context with a input buffer. */
void MD5::update(const void *input, size_t length) {
	update((const byte*)input, length);
}

/* Updating the context with a string. */
void MD5::update(const string &str) {
	update((const byte*)str.c_str(), str.length());
}

/* Updating the context with a file. */
void MD5::update(ifstream &in) {

	if (!in)
		return;

	std::streamsize length;
	char buffer[BUFFER_SIZE];
	while (!in.eof()) {
		in.read(buffer, BUFFER_SIZE);
		length = in.gcount();
		if (length > 0)
			update(buffer, length);
	}
	in.close();
}

/* MD5 block update operation. Continues an MD5 message-digest
operation, processing another message block, and updating the
context.
*/
void MD5::update(const byte *input, size_t length) {

	ulong i, index, partLen;

	_finished = false;

	/* Compute number of bytes mod 64 */
	index = (ulong)((_count[0] >> 3) & 0x3f);

	/* update number of bits */
	if((_count[0] += ((ulong)length << 3)) < ((ulong)length << 3))
		_count[1]++;
	_count[1] += ((ulong)length >> 29);

	partLen = 64 - index;

	/* transform as many times as possible. */
	if(length >= partLen) {

		memcpy(&_buffer[index], input, partLen);
		transform(_buffer);

		for (i = partLen; i + 63 < length; i += 64)
			transform(&input[i]);
		index = 0;

	} else {
		i = 0;
	}

	/* Buffer remaining input */
	memcpy(&_buffer[index], &input[i], length-i);
}

/* MD5 finalization. Ends an MD5 message-_digest operation, writing the
the message _digest and zeroizing the context.
*/
void MD5::final() {

	byte bits[8];
	ulong oldState[4];
	ulong oldCount[2];
	ulong index, padLen;

	/* Save current state and count. */
	memcpy(oldState, _state, 16);
	memcpy(oldCount, _count, 8);

	/* Save number of bits */
	encode(_count, bits, 8);

	/* Pad out to 56 mod 64. */
	index = (ulong)((_count[0] >> 3) & 0x3f);
	padLen = (index < 56) ? (56 - index) : (120 - index);
	update(PADDING, padLen);

	/* Append length (before padding) */
	update(bits, 8);

	/* Store state in digest */
	encode(_state, _digest, 16);

	/* Restore current state and count. */
	memcpy(_state, oldState, 16);
	memcpy(_count, oldCount, 8);
}

/* MD5 basic transformation. Transforms _state based on block. */
void MD5::transform(const byte block[64]) {

	ulong a = _state[0], b = _state[1], c = _state[2], d = _state[3], x[16];

	decode(block, x, 64);

	/* Round 1 */
	FF (a, b, c, d, x[ 0], S11, 0xd76aa478); /* 1 */
	FF (d, a, b, c, x[ 1], S12, 0xe8c7b756); /* 2 */
	FF (c, d, a, b, x[ 2], S13, 0x242070db); /* 3 */
	FF (b, c, d, a, x[ 3], S14, 0xc1bdceee); /* 4 */
	FF (a, b, c, d, x[ 4], S11, 0xf57c0faf); /* 5 */
	FF (d, a, b, c, x[ 5], S12, 0x4787c62a); /* 6 */
	FF (c, d, a, b, x[ 6], S13, 0xa8304613); /* 7 */
	FF (b, c, d, a, x[ 7], S14, 0xfd469501); /* 8 */
	FF (a, b, c, d, x[ 8], S11, 0x698098d8); /* 9 */
	FF (d, a, b, c, x[ 9], S12, 0x8b44f7af); /* 10 */
	FF (c, d, a, b, x[10], S13, 0xffff5bb1); /* 11 */
	FF (b, c, d, a, x[11], S14, 0x895cd7be); /* 12 */
	FF (a, b, c, d, x[12], S11, 0x6b901122); /* 13 */
	FF (d, a, b, c, x[13], S12, 0xfd987193); /* 14 */
	FF (c, d, a, b, x[14], S13, 0xa679438e); /* 15 */
	FF (b, c, d, a, x[15], S14, 0x49b40821); /* 16 */

	/* Round 2 */
	GG (a, b, c, d, x[ 1], S21, 0xf61e2562); /* 17 */
	GG (d, a, b, c, x[ 6], S22, 0xc040b340); /* 18 */
	GG (c, d, a, b, x[11], S23, 0x265e5a51); /* 19 */
	GG (b, c, d, a, x[ 0], S24, 0xe9b6c7aa); /* 20 */
	GG (a, b, c, d, x[ 5], S21, 0xd62f105d); /* 21 */
	GG (d, a, b, c, x[10], S22,  0x2441453); /* 22 */
	GG (c, d, a, b, x[15], S23, 0xd8a1e681); /* 23 */
	GG (b, c, d, a, x[ 4], S24, 0xe7d3fbc8); /* 24 */
	GG (a, b, c, d, x[ 9], S21, 0x21e1cde6); /* 25 */
	GG (d, a, b, c, x[14], S22, 0xc33707d6); /* 26 */
	GG (c, d, a, b, x[ 3], S23, 0xf4d50d87); /* 27 */
	GG (b, c, d, a, x[ 8], S24, 0x455a14ed); /* 28 */
	GG (a, b, c, d, x[13], S21, 0xa9e3e905); /* 29 */
	GG (d, a, b, c, x[ 2], S22, 0xfcefa3f8); /* 30 */
	GG (c, d, a, b, x[ 7], S23, 0x676f02d9); /* 31 */
	GG (b, c, d, a, x[12], S24, 0x8d2a4c8a); /* 32 */

	/* Round 3 */
	HH (a, b, c, d, x[ 5], S31, 0xfffa3942); /* 33 */
	HH (d, a, b, c, x[ 8], S32, 0x8771f681); /* 34 */
	HH (c, d, a, b, x[11], S33, 0x6d9d6122); /* 35 */
	HH (b, c, d, a, x[14], S34, 0xfde5380c); /* 36 */
	HH (a, b, c, d, x[ 1], S31, 0xa4beea44); /* 37 */
	HH (d, a, b, c, x[ 4], S32, 0x4bdecfa9); /* 38 */
	HH (c, d, a, b, x[ 7], S33, 0xf6bb4b60); /* 39 */
	HH (b, c, d, a, x[10], S34, 0xbebfbc70); /* 40 */
	HH (a, b, c, d, x[13], S31, 0x289b7ec6); /* 41 */
	HH (d, a, b, c, x[ 0], S32, 0xeaa127fa); /* 42 */
	HH (c, d, a, b, x[ 3], S33, 0xd4ef3085); /* 43 */
	HH (b, c, d, a, x[ 6], S34,  0x4881d05); /* 44 */
	HH (a, b, c, d, x[ 9], S31, 0xd9d4d039); /* 45 */
	HH (d, a, b, c, x[12], S32, 0xe6db99e5); /* 46 */
	HH (c, d, a, b, x[15], S33, 0x1fa27cf8); /* 47 */
	HH (b, c, d, a, x[ 2], S34, 0xc4ac5665); /* 48 */

	/* Round 4 */
	II (a, b, c, d, x[ 0], S41, 0xf4292244); /* 49 */
	II (d, a, b, c, x[ 7], S42, 0x432aff97); /* 50 */
	II (c, d, a, b, x[14], S43, 0xab9423a7); /* 51 */
	II (b, c, d, a, x[ 5], S44, 0xfc93a039); /* 52 */
	II (a, b, c, d, x[12], S41, 0x655b59c3); /* 53 */
	II (d, a, b, c, x[ 3], S42, 0x8f0ccc92); /* 54 */
	II (c, d, a, b, x[10], S43, 0xffeff47d); /* 55 */
	II (b, c, d, a, x[ 1], S44, 0x85845dd1); /* 56 */
	II (a, b, c, d, x[ 8], S41, 0x6fa87e4f); /* 57 */
	II (d, a, b, c, x[15], S42, 0xfe2ce6e0); /* 58 */
	II (c, d, a, b, x[ 6], S43, 0xa3014314); /* 59 */
	II (b, c, d, a, x[13], S44, 0x4e0811a1); /* 60 */
	II (a, b, c, d, x[ 4], S41, 0xf7537e82); /* 61 */
	II (d, a, b, c, x[11], S42, 0xbd3af235); /* 62 */
	II (c, d, a, b, x[ 2], S43, 0x2ad7d2bb); /* 63 */
	II (b, c, d, a, x[ 9], S44, 0xeb86d391); /* 64 */

	_state[0] += a;
	_state[1] += b;
	_state[2] += c;
	_state[3] += d;
}

/* Encodes input (ulong) into output (byte). Assumes length is
a multiple of 4.
*/
void MD5::encode(const ulong *input, byte *output, size_t length) {

	for(size_t i=0, j=0; j<length; i++, j+=4) {
		output[j]= (byte)(input[i] & 0xff);
		output[j+1] = (byte)((input[i] >> 8) & 0xff);
		output[j+2] = (byte)((input[i] >> 16) & 0xff);
		output[j+3] = (byte)((input[i] >> 24) & 0xff);
	}
}

/* Decodes input (byte) into output (ulong). Assumes length is
a multiple of 4.
*/
void MD5::decode(const byte *input, ulong *output, size_t length) {

	for(size_t i=0, j=0; j<length; i++, j+=4) {	
		output[i] = ((ulong)input[j]) | (((ulong)input[j+1]) << 8) |
			(((ulong)input[j+2]) << 16) | (((ulong)input[j+3]) << 24);
	}
}

/* Convert byte array to hex string. */
string MD5::bytesToHexString(const byte *input, size_t length) {
	string str;
	str.reserve(length << 1);
	for(size_t i = 0; i < length; i++) {
		int t = input[i];
		int a = t / 16;
		int b = t % 16;
		str.append(1, HEX[a]);
		str.append(1, HEX[b]);
	}
	return str;
}

/* Convert digest to string value */
string MD5::toString() {
	return bytesToHexString(digest(), 16);
}


#include "md5.h"
#include <iostream>

using namespace std;

void PrintMD5(const string &str, MD5 &md5) {
	cout << "MD5(\"" << str << "\") = " << md5.toString() << endl;
}

int main() {

	cout << MD5("abc").toString() << endl;

	MD5 md5;
	md5.update("");
	PrintMD5("", md5);

	md5.update("a");
	PrintMD5("a", md5);

	md5.update("bc");
	PrintMD5("abc", md5);

	md5.update("defghijklmnopqrstuvwxyz");
	PrintMD5("abcdefghijklmnopqrstuvwxyz", md5);

	md5.reset();
	md5.update("message digest");
	PrintMD5("message digest", md5);

	return 0;
}







MD5验证文件完整性 C++ 读取文件内容并且做MD5验证 C++ 为了验证下载的文件是否完整,是否被篡改,常用的验证方法为MD5验证,文件生成32位验证码,可验证文件是否完整下载或被篡改。 md5.h文件 #ifndef MD5_H #define MD5_H #include <string> #include <fstream> /* Type define */ typedef un... 阅读详情

相关推荐

C++实现MD5算法:从原理到文件校验的完整指南

哈希函数是计算机科学中用于数据完整性验证和唯一标识生成的基础工具,其核心原理是将任意长度的输入通过特定算法映射为固定长度的输出,即哈希值。MD5作为一种经典的密码散列函数,通过四轮非线性变换和位运算,能够快速生成128位的“数字指纹”,具备雪崩效应和单向性等技术特点。在工程实践中,MD5因其计算高效、实现简单,常被用于文件完整性校验、缓存键生成和数据去重等非安全敏感场景。本文以C++为例,详细解析了MD5算法的数据填充、缓冲区初始化、四轮变换等核心步骤,并提供了完整的、可编译的源码实现,重点解决了字节序处理

weixin_33812433的博客 347

用C++计算文件的MD5值

用C++计算文件的MD5值,相关的代码如下: md5.h #ifndef MD5_H #define MD5_H #include &lt;string&gt; #include &lt;fstream&gt; /* Type define */ typedef unsigned char byte; typedef unsigned int uint32; using std::st...

积累点滴,保持自我 1万+

linux openssl C++ md5开发实例

MD5(Message Digest Algorithm 5)是一种广泛用于产生消息摘要(哈希值)的算法。MD5 属于 MD(Message Digest)家族,设计用于生成128位(16字节)的哈希值。然而,由于其设计上的一些弱点,MD5 在一些安全应用中被认为不再安全。MD5 生成的哈希值始终是128位长,不论输入的长度如何。MD5 的计算速度相对较快,适用于对大量数据进行哈希的场景。MD5 是一个单向哈希函数,即从哈希值不能逆向推导出原始输入。

N阶二进制的博客 1094

MD5介绍与MD5加密的C++实现

MD5相信绝大数人都接触过,也有无数人问过我怎么做MD5解密。 当然,我们知道MD5自然没有办法解密,所以解密也不过是大量已知数据做成字典而已,MD5是不可能通过逆向计算解密的。 为什么呢?因为哈希冲突。 举个简单的例子: 比如说我给定10个位置来存放东西,假设我的对应方法是简单的求余%。 那么11%10,21%10的结果就会相同。这样就造成了冲突。 MD5也是如此,我们常用的MD5位...

mijichui2153的博客 1万+

MD5算法(Linux C实现)

基础算法,源码实现如下: #include <linux/types.h> #include <linux/skbuff.h> #include <linux/init.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/ctype.h> #define MD5_BLOCK_LENGTH 64 #define MD.

一年一年又一年 1112

Linux C/C++ 内核态算法导航

Linux C AES-GCM算法(内核态)https://blog.youkuaiyun.com/afk_02/article/details/121768143 Linux C hmac-sha1 算法(内核态)https://blog.youkuaiyun.com/afk_02/article/details/121654188 Linux C 字符串快速搜索(内核态)https://blog.youkuaiyun.com/afk_02/article/details/121601806 Linux C B+树算法源码(内核态+重

一年一年又一年 1901

Linux下MD5算法使用

作者:无脑仔的小明  出处:http://www.cnblogs.com/wunaozai/  我们以一个字符串为例,新建一个文件filename.txt,在文件内写入hello ,然后在Linux下可以使用命令md5sum filename.txt计算md5值 ==&gt; b1946ac92492d2347c6235b4d2611184  。虽然写入的是hello这5个字符,但是我们使用命令...

Eunice_fan1207的博客 2555

基于C++实现 MD5 算法的文件完整性校验程序

实际赋值的时候应该赋值为 A=0x67452301, B=0xefcdab89,C=0x98badcfe,D=0x10325476。(6) MD5Update.cpp:MD5 类中 Update 相关函数,包括 2 个 public 函数和 1 个 private 函数。(5) MD5.cpp:MD5 类的部分功能实现,主要为 Reset 函数,Tostring 函数,Transform 函数。(1)问题:大小端编址问题。(4) MD5.h:MD5 类定义,包括一些运算的 define。

神仙别闹的自留地 977

[C/C++]MD5校验的学习

1. 对输入的数据进行填充对信息进行数据填充,使信息的长度对512取模得448,设信息长度为X,即满足X mod 512=448(x/512d的余数等于448)。根据此公式得出需要填充的数据长度。填充方法是在信息后面填充第一位为1,其余为0。填充完后,信息的长度就为N*512+448(bit)。2. 填入输入信息的长度原信息长度用64位(二进制)表示。如果信息长度大于264,则只使用其低64位的值,即(信息长度对264取模),并且填充到前面一步得到的结果后面。

pysont的博客 1113

基于C++实现 MD5 算法的文件完整性校验程序【100010122】

详情介绍:https://www.yuque.com/sxbn/ks/100010122 基于 MD5 算法的文件完整性校验程序,本实验使用 C++ 语言在 Linux 平台进行编程和运行。 ./md5 -h 查看帮助 ./md5 -t 打印程序的测试信息 ./md5 -c nankai.txt 计算出的被测文件的 MD5 摘要并打印 ./md5 -v nankai.txt 验证文件完整性方法一 ./md5 -f nankai.txt nankai.md5 验证文件完整性方法二 实验涉及的文件包括: (1) main.cpp:主函数文件。 (2) helpFunc.h:功能函数定义。 (3) helpFunc.cpp:功能函数实现。 (4) MD5.h:MD5 类定义。 (5) MD5.cpp:MD5 类的部分函数实现。 (6) MD5Update.cpp:MD5 类中 Update 相关函数实现。 (7) MD5codePro.cpp:MD5 类中进制转换、类型变换相关函数实现。 (8) nankai.txt 和 nankai.md5:测试文件 (9) m

文件批量修改MD5随机重命名

文件批量修改MD5随机重命名

【Linux C/C++开发】使用hash算法进行性能优化

C/C++项目可以直接接触到系统级接口,在出现性能问题(比如内存使用、CPU占用、读写IO、网络传输等)时,需要深入的进行解决,没有现成的框架可以直接套用,本篇主要介绍适合使用hash算法的场景。

ocy的博客 1212

别再让地图加载慢吞吞!GeoServer + GeoWebCache 缓存配置实战(附性能对比)

本文详细介绍了如何通过GeoServer和GeoWebCache优化地图服务性能,实现地图加载速度的显著提升。从缓存机制解析到实战配置流程,再到高级性能调优技巧,帮助开发者构建高效地图缓存系统,解决地图加载慢的问题。

weixin_42525369的博客 405

C++实现MD5类(Windows、Linux通用)

C++实现MD5类(Windows、Linux通用) 已修复Windows、Linux两个平台使用数据模型不同的问题

Alderaan的博客 1311

基于STM32F407标准库与SimpleFOC实现无刷电机2804位置闭环控制的实战解析

本文详细解析了基于STM32F407标准库与SimpleFOC算法实现2804无刷电机位置闭环控制的实战过程。通过硬件选型、速度闭环调试到位置环PID参数整定,提供了完整的工程实现方案和抗饱和策略,帮助开发者掌握高精度电机控制技术。

oauth7security的博客 916

Materials Studio多层聚合物建模全流程:从Build Layers到LAMMPS data文件导出避坑指南

本文详细解析了使用Materials Studio构建多层聚合物模型并导出为LAMMPS data文件的全流程。重点剖析了Build Layers工具的核心逻辑、真空层处理技巧,并提供了解决导出过程中Z轴坐标偏移问题的实战方案,特别是如何利用msi2lmp工具的-shift参数进行精准校正,确保模型在LAMMPS中模拟的稳定性和准确性。

hhh00的博客 913

MD5 算法概述以及c++实现

MD5算法概述以及c++实现   一、MD5介绍      Message Digest Algorithm MD5(中文名为消息摘要算法第五版)为计算机安全领域广泛使用的一种散列函数,用以提供消息的完整性保护。此算法以任意长度的信息(message)作为输入进行计算,产生一个128-bit(16-byte)的指纹或报文摘要(fingerprint or message digest)。...

MarshalRUAN 267

海量Embedding进行相似度查询和比较的方法

这个是在科研中的现实需求。例如每一个源代码文件,我们可以生成一个embedding,如果有超过5000万个embedding(例如用BERT生成5000万个embedding),怎么样有效地计算相似性呢(例如有5000个positive的embedding,想在5000万个中找到类似的)。 简单介绍一下我尝试的结果:如果直接用torch.cosine_similarity,我手里的数据估计至少要处理两个月。这时候就想到了用LSH -- Locality Sensitive Hashing,但是我之前并没怎

qysh123的专栏 4566

md5加密 linux c/c++

<br />我的软件是ubuntu10.4:首先确保你的电脑上装有openssl,如果没有可以手动安装 :输<br />入sudo apt-get install openssl libssl-dev然后回车等待 就OK啦<br />第一种方法:<br />////////////////md5Test.c;///////////////////////<br />#include<stdio.h><br />#include<openssl/md5.h><br />#include<string.h><b

win的小屋 5293

KCP(快速可靠UDP)——用带宽换延迟的极致艺术

想象你是一个外卖平台的调度员。这就是KCP的本质——

本博客聚焦游戏开发技巧、创业实战心得及大学热门课程干货。这里既有技术深度,也有思维广度,无论你是开发者、创业者还是高校学子,都能在这里找到适合自己的成长之路! 202

Multisim14使用教程详尽版--(2025最新版)

摘要:本文详细介绍了Multisim14电路仿真软件的功能和使用方法。主要内容包括:1)主流电路仿真软件比较,突出Multisim在教学、竞赛设计中的优势;2)软件界面说明,涵盖菜单栏、工具栏、元器件库和仪器仪表;3)18类元器件分类详解及其使用操作;4)15种仪器仪表的原理和应用场景;5)电路原理图设计与仿真流程;6)基本电路分析方法(直流静态工作点分析、交流分析等)。文章还提供了硬件工程师笔试面试相关资源链接,涵盖电阻、电容、三极管等器件知识及AD软件操作指南。通过系统讲解,帮助用户掌握Multisim

XU157303764的博客 2万+

linux c/c++ 后台开发常用算法之:一致性哈希算法

一致性哈希主要应用在大规模高可用性的分布式存储上,尤其是KV存储上面,比如memcaced, redis 集群,相比普通hash % N 的优点在于,但动听增加或者删除节点的时候,数据的迁移会比较小,通常只有部分抖动和迁移。但是其相对于hash %N 的缺点数据均匀性肯定不如 hash %N 尤其是数据的key在一个较小的范围内,容易出现均匀的现象,但是可以通过hash函数调优,以及增加虚拟节点的方法来降低不均匀性。下面试自己写的一个c++版本的一致性哈希算法

实践是检验真理的唯一标准 2792

我的python学习之路

Python 是一门功能强大且易于学习的编程语言,广泛应用于数据分析、人工智能、Web 开发、自动化等领域。以下是一个 Python 学习路径的总结,帮助你系统地掌握 Python 编程。

数据知道的博客 3万+

linux c md5加密,md5加密 linux c/c++

我的软件是ubuntu10.4:首先确保你的电脑上装有openssl,如果没有可以手动安装 :输入sudo apt-get install openssl libssl-dev然后回车等待 就OK啦第一种方法:////////////////md5Test.c;///////////////////////#include#include#includeint main(){MD5_CTX ctx...

weixin_42564147的博客 249

AttributeError: module ‘lib‘ has no attribute ‘X509_V_FLAG_CB_ISSUER_CHECK‘解决方案

本文主要介绍了AttributeError: module ‘lib’ has no attribute 'X509_V_FLAG_CB_ISSUER_CHECK’解决方案,希望能对使用python的同学们有所帮助。 文章目录 1. 问题描述 2. 解决方案

weixin_43178406的博客 5万+

最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版

Part-E1-SDIO-Specification-Ver4.00-Final-120220.pdf:最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版,包括SDIO 接口的外设,SDIO 接口官方协议等。

上一篇: linux c/c++ 后台开发常用组件之: 高性能local cache
下一篇: linux c/c++ 后台开发常用算法之:一致性哈希算法
菜鸟懿
博客等级 码龄14年 98粉丝 42原创
评论 1
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值