I want to use a hash function (SHA1) to determine whether two DWG models from AutoCAD 2018 are identical or not. To test if this works, I created two empty dwg files and used the SHA1 function in c# (System.Security.Cryptography.sha1) to calculate the hash code.
I was expecting resulting codes to be identical, since I only started two new empty models and then saved them directly. The only data which should differ is the name and date & time of creation (all meta data, which shouldn't play a role for the algorithm). Yet, the result was two different hash codes.
So I looked into the byte array of the two files. The only thing I could get out of it (a lot of lines which I could not interpret in any way), was that some of the meta data as date and time of creation is written in the byte array. Therefore the two files are actually not identical, eventhough the models are. So there will always be a different hash code for all hashed DWG models.
Does anyone know of this problem or a work-around for my issue?
Snippet of the byte array in which the saving time and date is captured:
A p p I n f o D a t a L i s t �H��
M��ρ��P� 2 2 . 0 . 4 9 . 0 . 0 ���%�דI����(o��r A u t o d e s k D W G . T h i s f i l e i s a T r u s t e d D W G l a s t s a v e d b y a n A u t o d e s k a p p l i c a t i o n o r A u t o d e s k l i c e n s e d a p p l i c a t i o n . �����Oh�� +'��J< p r o p _ s e t f m t _ i d = " { f 2 9 f 8 5 e 0 - 4 f f 9 - 1 0 6 8 - a b 9 1 - 0 8 0 0 2 b 2 7 b 3 d 9 } " > < p r o p i d = " 8 " > < s t r i n g > M a x < / s t r i n g > < / p r o p > < p r o p i d = " 1 0 " > < d a t e t i m e > 2 0 2 0 - 0 7 - 1 4 T 0 9 : 5 1 : 3 3 < / d a t e t i m e > < / p r o p > < p r o p i d = " 2 5 8 " > < s t r i n g > A u t o C A D 2 0 1 8 < / s t r i n g > < / p r o p > < p r o p i d = " 2 5 9 " > < s t r i n g > O . 4 9 . 0 . 0 < / s t r i n g > < / p r o p > < p r o p i d = " 1 2 " > < d a t e t i m e > 2 0 2 0 - 0 7 - 1 4 T 0 9 : 5 1 : 2 9 < / d a t e t i m e > < / p r o p > < / p r o p _ s e t > ���Q�βD����;��D� " < P r o d u c t I n f o r m a t i o n n a m e = \ " A u t o C A D \ " b u i l d _ v e r s i o n = \ " O . 4 9 . 0 . 0 ( x 6 4 ) \ " r e g i s t r y _ v e r s i o n = \ " 2 2 . 0 \ " i n s t a l l _ i d _ s t r i n g = \ " A C A D - 1 0 0 1 : 4 0 9 \ " r e g i s t r y _ l o c a l e I D = \ " 1 0 3 3 \ " > "