SHL test
前言
再看一段產生密鑰的反匯編片段,看到SHL居然用負數移位。
做了一個測試
當SHL移位值為一個負數, e.g. shl [mm], cl
cl = 0xAE,
結果為SHL(x % 32), 這樣解釋也挺合理的
SHL 移動的是CL, 移位值應該是%16
試驗記錄
// hw.cpp : Defines the entry point for the console application. //#include "stdafx.h" #include <windows.h> #include <stdlib.h> #include <stdio.h> #include <math.h>#include <WinCrypt.h> #pragma comment(lib, "crypt32.lib")void fnTestSHL();void main(void) {fnTestSHL(); }void fnTestSHL() { /* 004131E4 >52 DD 4E 2F R軳/.ecx = FFFFFFAEcl = 0xAE (-82)00406094 |. D325 E4314100 shl dword ptr ds:[<g_dwEncInitVector>],cl移位后004131E4 >00 80 54 B7 .€T? */ DWORD dwSrc = 0x2f4edd52; DWORD dwShlBit = 0xFFFFFFAE;__asm {pushamov ecx, dwShlBit; 0xae = 174, 174 % 32 = 14mov cl, 14shl dwSrc, clpopa}if (0xb7548000 == dwSrc) {printf("same to OD\r\n"); // 到這了} }總結
- 上一篇: 生成HTML测试报告
- 下一篇: SHL