Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
Tags
- ESP32 #Arduino
- x99 itx/ac
- Linux #VirtualBox
- macro lens #EF #FD
- XTU #Virtual Machine System
- centos7 #yum update #/boot
- VNC #Firewall #CenOS7 #VMware
- Xeon #E5-2680
- cycloidal #rv reducer
- CM-EF-NEX
- Arduino #PlatformIO #macOS
- Laptop #CPUID
- Octave #homebrew #macOS
- egpu #aorus gaming box #gtx1070 #tb3
- VirtualBox #VMware
- TensorFlow #Python #pip
- Oh My Zsh #macOS
- Arduino #Wall Plotter
- k6 #피코프레소
- VMware #Shared Folder
- 다이슨 #배터리
- 매크로렌즈 #리버스링
- ITOP40
- Callaway #Mavrik #Epic Flash
- Tarantula #3D 프린터
- razer #deathadder #viper #g102
- 피코프레소 #ITOP40
- fat32 #rufus
- Dell #Latitude #BIOS
- Java #MacBook #macOS
Archives
- Today
- Total
얕고 넓게
[비트코인] Message & SHA256 정리 본문
2025.02.04
모두 정리가 되었지만 Byte Order 가 이해가 안돼서 다시 확인.
현재 코드기준
version + previous hash + root hash + ...
각 아이템은 보통의 Big Endian 이지만 전체로 보면 Little Endian이 되어야 한다.
string msg = “00112233…”
message[0] = 0x00;
message[1] = 0x11;
message[2] = 0x22;
message[3] = 0x33;
sha256_top에서 1byte 데이터를 4byte로 만들 때 Little로 바꾼다.
UINT msg = 0x00112233;
sha256_core에서 BIG_ENDIAN이 선언되어 있지 않기 때문에 Little을 다시 Big으로 바꾼다.
#if defined(BIG_ENDIAN)
#define GetData(x) x
#else
#define GetData(x) ENDIAN_REVERSE_ULONG(x)
#endif
W0:for (int j = 0; j < 16; j++)
W[j] = GetData(Message[j]);
따라서 W
W[0] = 0x33221100;
sha256 내부는 4byte Big Endian 처리
Little Endian 표시
02000000 ........................... Block version: 2
b6ff0b1b1680a2862a30ca44d346d9e8
910d334beb48ca0c0000000000000000 ... Hash of previous block's header
9d10aa52ee949386ca9385695f04ede2
70dda20810decd12bc9b048aaab31471 ... Merkle root
24d95a54 ........................... [Unix time][unix epoch time]: 1415239972
30c31b18 ........................... Target: 0x1bc330 * 256**(0x18-3)
fe9f0864 ........................... Nonce
'IT > 비트코인' 카테고리의 다른 글
[비트코인] SHA256 & 채굴 (최종?) (0) | 2025.01.09 |
---|---|
[비트코인] KISA SHA256 테스트 (0) | 2025.01.02 |
[비트코인] Python 채굴 (0) | 2022.02.05 |