Skip to content

Commit 84f68ed

Browse files
authored
Open source DxilHash (microsoft#6846)
This pull request introduces the open-source implementation of hashing functionality for DXIL containers. DxilHash.cpp: Implements DXBC/DXIL container hashing functions. This is first part for microsoft#6808
1 parent 99f2d49 commit 84f68ed

File tree

7 files changed

+661
-0
lines changed

7 files changed

+661
-0
lines changed

include/dxc/DxilHash/DxilHash.h

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
///////////////////////////////////////////////////////////////////////////////
2+
// //
3+
// DxilHash.h //
4+
// Copyright (C) Microsoft Corporation. All rights reserved. //
5+
// This file is distributed under the University of Illinois Open Source //
6+
// License. See LICENSE.TXT for details. //
7+
// //
8+
// //
9+
// DXBC/DXIL container hashing functions //
10+
// //
11+
///////////////////////////////////////////////////////////////////////////////
12+
13+
#pragma once
14+
15+
#define DXIL_CONTAINER_HASH_SIZE 16
16+
17+
// Prototype for hash computing function
18+
// pOutHash must always return a DXIL_CONTAINER_HASH_SIZE byte hash result.
19+
typedef void HASH_FUNCTION_PROTO(const BYTE *pData, UINT32 byteCount,
20+
BYTE *pOutHash);
21+
22+
// **************************************************************************************
23+
// **** DO NOT USE THESE ROUTINES TO PROVIDE FUNCTIONALITY THAT NEEDS TO BE
24+
// SECURE!!! ***
25+
// **************************************************************************************
26+
// Derived from: RSA Data Security, Inc. M
27+
// D
28+
// 5 Message-Digest Algorithm
29+
// Computes a 128-bit hash of pData (size byteCount), returning 16 BYTE output
30+
void ComputeHashRetail(const BYTE *pData, UINT32 byteCount, BYTE *pOutHash);
31+
void ComputeHashDebug(const BYTE *pData, UINT32 byteCount, BYTE *pOutHash);
32+
// **************************************************************************************
33+
// **** DO NOT USE THESE ROUTINES TO PROVIDE FUNCTIONALITY THAT NEEDS TO BE
34+
// SECURE!!! ***
35+
// **************************************************************************************

lib/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ add_subdirectory(DxcSupport) # HLSL Change
2525
add_subdirectory(HLSL) # HLSL Change
2626
add_subdirectory(DXIL) # HLSL Change
2727
add_subdirectory(DxilContainer) # HLSL Change
28+
add_subdirectory(DxilHash) # HLSL Change
2829
add_subdirectory(DxilPdbInfo) # HLSL Change
2930
add_subdirectory(DxilPIXPasses) # HLSL Change
3031
add_subdirectory(DxilDia) # HLSL Change

lib/DxilHash/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
2+
add_llvm_library(LLVMDxilHash
3+
DxilHash.cpp)

0 commit comments

Comments
 (0)