summaryrefslogtreecommitdiff
path: root/Scripts/get_dxbc_hash.py
blob: 0c531079cd747505a898dc032a46d03cab6d0a3f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#! /usr/bin/env python3

import sys
import os.path
import struct

if not os.path.isfile(sys.argv[1]):
    print(f'File not found: {sys.argv[1]}')
    sys.exit(1)

for path in sys.argv[1:]:
    print(path + ':')
    with open(path, 'rb') as f:
        if f.read(4).decode('ASCII') == 'DXBC':
            print(' %08x-%08x-%08x-%08x' % (struct.unpack('<I', f.read(4))[0], struct.unpack('<I', f.read(4))[0], struct.unpack('<I', f.read(4))[0], struct.unpack('<I', f.read(4))[0]))
        else:
            print(' Invalid DXBC file.')