3DES, also known as 3DESede or TripleDES, is an algorithmic scheme that triple-data encrypts and can be reversed. In 1975, IBM successfully researched and released the DES encryption algorithm, but the DES password length was easily brute-forced. By modifying the DES algorithm, three DES encryptions were performed for each data block, that is, the 3DES encryption algorithm. However, since the algorithm of 3DES is public, the algorithm itself has no secret at all, and mainly relies on a unique key to ensure the security of data encryption and decryption.
Some people may ask, is that 3DES safe? ! So far, no one can crack 3DES, so if you can crack it, it is enough to shock the entire information security community.
Brief Analysis of 3DES Encryption AlgorithmThe 3DES encryption algorithm is not a new encryption algorithm, but another mode of the DES algorithm. It is a more common symmetric encryption algorithm, which is more secure than DES. The encryption and decryption process of the algorithm is to perform three DES encryption or decryption on the plaintext/ciphertext data to obtain the corresponding ciphertext or plaintext. Suppose EK() and DK() represent the encryption and decryption functions of DES, respectively, P for plaintext and C for ciphertext. The formula for encryption and decryption is as follows:
Encryption: C = EK3 ( DK2( EK1(P) ) ) is the process of encrypting the data, encrypting --- decrypting --- encrypting, and finally getting the ciphertext data
Decryption: P = DK1 ( EK2 ( DK3 ( C ) ) ) is the process of decrypting ciphertext data , decrypting -- " encryption -- " decryption process , and finally getting clear text data
Where: K1 represents the first 8-byte key in 3DES, K2 represents the second 8-byte key, and K3 represents the third 8-byte key. Normally, the 3DES key is double long secret. Key (if you don't know double length, you can refer to the explanation in the blogger's key-dividing algorithm article), that is, K1 corresponds to KL (left 8 bytes), K2 corresponds to KR (right 8 bytes), and K3 corresponds to KL ( 8 bytes left).
Since the DES encryption and decryption algorithm is used as an encryption and decryption data block every 8 bytes, when the algorithm is implemented, the data needs to be divided and complemented (that is, when the last 8 bytes are less than 8 bytes). The API provided by Java itself is NoPadding, Zeros Fill and PKCS5Padding. Suppose we want to encrypt 9 bytes of data, the corresponding fill description is as follows:
ZerosPadding
All bytes without data are filled with 0
First block: F0 F1 F2 F3 F4 F5 F6 F7
Second block: F8 0 0 0 0 0 0 0
PKCS5Padding
Each padded byte records the length of the padding
First block: F0 F1 F2 F3 F4 F5 F6 F7
Second block: F8 07 07 07 07 07 07 07
The specific algorithm process of DES is very complicated. I don't understand the truth. I can only use the API that comes with Android and iOS to implement the 3DES process. The specific code is as follows:
Android code
[plain] view plain copypublic byte[] triDesEncrypt(byte[] desKey, byte[] desData, int flag) {//flag == 1 for encryption, flag == 0 for decryption
Byte[] keyFirst8 = new byte[8];
Byte[] keySecond8 = new byte[8];
If (desKey.length 》 8) {
For (int i = 0; i " 8; i++) {
keyFirst8[i] = desKey[i];
}
} else {
Return null;
}
If (desKey.length " 16) {
For (int i = 0; i " desKey.length - 8; i++) {
keySecond8[i] = desKey[i + 8];
}
} else {
For (int i = 0; i " 8; i++) {
keySecond8[i] = desKey[i + 8];
}
}
Byte[] tmpKey = new byte[8];
Byte[] tmpData = new byte[8];
arrayCopy(keyFirst8, 0, tmpKey, 0, 8);
arrayCopy(desData, 0, tmpData, 0, 8);
Int mode = flag;
Byte[] result = unitDes(tmpKey, tmpData, mode);
arrayCopy(keySecond8, 0, tmpKey, 0, 8);
arrayCopy(result, 0, tmpData, 0, 8);
Mode = (mode == 1) ? 0 : 1;
Result = unitDes(tmpKey, tmpData, mode);
arrayCopy(keyFirst8, 0, tmpKey, 0, 8);
arrayCopy(result, 0, tmpData, 0, 8);
Mode = (mode == 1) ? 0 : 1;
Result = unitDes(tmpKey, tmpData, mode);
Return result;
}
iOS code
[plain] view plain copy+ (NSData *)encryptWithDataKey:(NSData *)src key1:(NSData *)key1 key2:(NSData *)key2 key3:(NSData *)key3
{
If (src == nil || [src length] == 0 ||
Key1 == nil || [key1 length] == 0 ||
Key2 == nil || [key2 length] == 0 ||
Key3 == nil || [key3 length] == 0) {
Return nil;
}
Const void *vplainText;
Size_t plainTextBufferSize;
plainTextBufferSize = [src length];
vplainText = [src bytes];
CCCryptorStatus ccStatus;
Uint8_t *bufferPtr = NULL;
Size_t bufferPtrSize = 0;
Size_t movedBytes = 0;
bufferPtrSize = (plainTextBufferSize + kCCBlockSize3DES) & ~(kCCBlockSize3DES - 1);
bufferPtr = malloc(bufferPtrSize * sizeof(uint8_t));
Memset((void *)bufferPtr, 0x00, bufferPtrSize);
NSMutableData *key = [NSMutableData data];
[key appendData:key1];
[key appendData:key2];
[key appendData:key3];
NSString *initVec = @"01234567";
Const void *vKey = [key bytes];
Const void *vinitVec = (const void *)[initVec UTF8String];
Uint8_t iv[kCCBlockSize3DES];
Memset((void *)iv, 0x00, (size_t)sizeof(iv));
ccStatus = CCCrypt(kCCEncrypt, kCCAlgorithm3DES, kCCOpTIonPKCS7Padding | kCCOpTIonECBMode, vKey, kCCKeySize3DES, vinitVec, vplainText, plainTextBufferSize, (void *)bufferPtr, bufferPtrSize, &movedBytes);
If (ccStatus != kCCSuccess) {
Free(bufferPtr);
Return nil;
}
NSData *result = [NSData dataWithBytes:bufferPtr length:movedBytes];
Free(bufferPtr);
Return result;
}
+ (NSData *)decryptWithDataKey:(NSData *)src key1:(NSData *)key1 key2:(NSData *)key2 key3:(NSData *)key3
{
If (src == nil || [src length] == 0 ||
Key1 == nil || [key1 length] == 0 ||
Key2 == nil || [key2 length] == 0 ||
Key3 == nil || [key3 length] == 0) {
Return nil;
}
Const void *vplainText;
Size_t plainTextBufferSize;
plainTextBufferSize = [src length];
vplainText = [src bytes];
CCCryptorStatus ccStatus;
Uint8_t *bufferPtr = NULL;
Size_t bufferPtrSize = 0;
Size_t movedBytes = 0;
bufferPtrSize = (plainTextBufferSize + kCCBlockSize3DES) & ~(kCCBlockSize3DES - 1);
bufferPtr = malloc(bufferPtrSize * sizeof(uint8_t));
Memset((void *)bufferPtr, 0x00, bufferPtrSize);
NSMutableData *key = [NSMutableData data];
[key appendData:key1];
[key appendData:key2];
[key appendData:key3];
NSString *initVec = @"01234567";
Const void *vkey = [key bytes];
Const void *vinitVec = (const void *)[initVec UTF8String];
Uint8_t iv[kCCBlockSize3DES];
Memset((void *)iv, 0x00, (size_t)sizeof(iv));
ccStatus = CCCrypt(kCCDecrypt, kCCAlgorithm3DES, kCCOpTIonPKCS7Padding | kCCOpTIonECBMode, vkey, kCCKeySize3DES, vinitVec, vplainText, plainTextBufferSize, (void *)bufferPtr, bufferPtrSize, &movedBytes);
If (ccStatus != kCCSuccess) {
Free(bufferPtr);
Return nil;
}
NSData *result = [NSData dataWithBytes:bufferPtr length:movedBytes];
Free(bufferPtr);
Return result;
}   
Immersion Cooling is a technique used to cool components of IT equipment that consists of submerging the computer components in a thermally conductive and dielectric liquid. Through this practice, the servers are cooled and heat is transferred from the source to the liquid.
When we talk about Immersion Cooling, we also need to discuss the different types of Immersion Cooling, as well as the applications of Immersion cooling. The practice of Immersion Cooling has a multitude of benefits particularly as it allows datacenters to be managed in a greener and more sustainable manner. Environmental concerns has been a huge catalyst for the adoption of the technology in recent years.
deionized water
mineral oil
fluorocarbon-based fluids
synthetic
Immersion Cooling systems used to have a higher fluid cost than water cooling, but this is already changing.
A wide variety of liquids exist for this purpose, the most suitable being transformer oils and other electrical cooling oils. Non-purpose oils, including cooking, motor and silicone oils, have been successfully used for cooling personal computers
water cooling,oil cooling,immersion cooling box,liquid immersion cooling,apw12 power supply
Shenzhen YLHM Technology Co., Ltd. , https://www.hkcryptominer.com