summaryrefslogtreecommitdiff
path: root/Scripts/get_dxbc_hash.py
diff options
context:
space:
mode:
Diffstat (limited to 'Scripts/get_dxbc_hash.py')
-rwxr-xr-xScripts/get_dxbc_hash.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/Scripts/get_dxbc_hash.py b/Scripts/get_dxbc_hash.py
new file mode 100755
index 0000000..0c53107
--- /dev/null
+++ b/Scripts/get_dxbc_hash.py
@@ -0,0 +1,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.')