<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Calculating the Checksum on a local file in Vault Customization Forum</title>
    <link>https://forums.autodesk.com/t5/vault-customization-forum/calculating-the-checksum-on-a-local-file/m-p/7543389#M10759</link>
    <description>&lt;P&gt;Imagine life&amp;nbsp;without&amp;nbsp;web.archive.org&amp;nbsp;&lt;img id="smileysurprised" class="emoticon emoticon-smileysurprised" src="https://forums.autodesk.com/i/smilies/16x16_smiley-surprised.png" alt="Smiley Surprised" title="Smiley Surprised" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;using System;
using System.IO;

namespace Vbaccelerator.Components.Algorithms
{
   /// &amp;lt;summary&amp;gt;
   /// Calculates a 32bit Cyclic Redundancy Checksum (CRC) using the
   /// same polynomial used by Zip.
   /// &amp;lt;/summary&amp;gt;
   public class CRC32
   {      
      private UInt32[] crc32Table;
      private const int BUFFER_SIZE = 1024;

      /// &amp;lt;summary&amp;gt;
      /// Returns the CRC32 for the specified stream.
      /// &amp;lt;/summary&amp;gt;
      /// &amp;lt;param name="stream"&amp;gt;The stream to calculate the CRC32 for&amp;lt;/param&amp;gt;
      /// &amp;lt;returns&amp;gt;An unsigned integer containing the CRC32
       calculation&amp;lt;/returns&amp;gt;
      public UInt32 GetCrc32(System.IO.Stream stream)
      {
         unchecked
         {
            UInt32 crc32Result;
            crc32Result = 0xFFFFFFFF;
            byte[] buffer = new byte[BUFFER_SIZE];
            int readSize = BUFFER_SIZE;

            int count = stream.Read(buffer, 0, readSize);
            while (count &amp;gt; 0)
            {
               for (int i = 0; i &amp;lt; count; i++)
               {
                  crc32Result = ((crc32Result) &amp;gt;&amp;gt; 8) ^ crc32Table[(buffer[i]) ^
                   ((crc32Result) &amp;amp; 0x000000FF)];
               }
               count = stream.Read(buffer, 0, readSize);
            }
            
            return ~crc32Result;
         }
      }

      /// &amp;lt;summary&amp;gt;
      /// Construct an instance of the CRC32 class, pre-initialising the table
      /// for speed of lookup.
      /// &amp;lt;/summary&amp;gt;
      public CRC32()
      {
         unchecked
         {
            // This is the official polynomial used by CRC32 in PKZip.
            // Often the polynomial is shown reversed as 0x04C11DB7.
            UInt32 dwPolynomial = 0xEDB88320;
            UInt32 i, j;

            crc32Table = new UInt32[256];

            UInt32 dwCrc;
            for(i = 0; i &amp;lt; 256; i++)
            {
               dwCrc = i;
               for(j = 8; j &amp;gt; 0; j--)
               {
                  if ((dwCrc &amp;amp; 1)==1)
                  {
                     dwCrc = (dwCrc &amp;gt;&amp;gt; 1) ^ dwPolynomial;
                  }
                  else
                  {
                     dwCrc &amp;gt;&amp;gt;= 1;
                  }
               }
               crc32Table[i] = dwCrc;
            }
         }
      }
   }
}&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 14 Nov 2017 16:48:39 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2017-11-14T16:48:39Z</dc:date>
    <item>
      <title>Calculating the Checksum on a local file</title>
      <link>https://forums.autodesk.com/t5/vault-customization-forum/calculating-the-checksum-on-a-local-file/m-p/4682085#M10753</link>
      <description>&lt;P&gt;&lt;A href="https://forums.autodesk.com/t5/Vault-Customization/API-Doug-s-checksum-function-doesn-t-seem-to-work-for-me/m-p/3093818/highlight/true#M25" target="_blank"&gt;http://forums.autodesk.com/t5/Vault-Customization/API-Doug-s-checksum-function-doesn-t-seem-to-work-for-me/m-p/3093818/highlight/true#M25&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The above thread is a dead end, so to repeat AlexF1980 question :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Where is the mentioned C# code sample from "vault mirror"? Doing a exhausted search in the SDK folder reveals nothing??&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any links? Please...&lt;/P&gt;</description>
      <pubDate>Mon, 09 Dec 2013 16:20:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vault-customization-forum/calculating-the-checksum-on-a-local-file/m-p/4682085#M10753</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-12-09T16:20:16Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating the Checksum on a local file</title>
      <link>https://forums.autodesk.com/t5/vault-customization-forum/calculating-the-checksum-on-a-local-file/m-p/4682683#M10754</link>
      <description>There are a variety of implementations of CRC32 which should all produce the same result, but which can have very different performance characteristics.
I think if you google "crc32 c# implementation", you will find one that suits your needs.

-Dave</description>
      <pubDate>Mon, 09 Dec 2013 21:11:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vault-customization-forum/calculating-the-checksum-on-a-local-file/m-p/4682683#M10754</guid>
      <dc:creator>minkd</dc:creator>
      <dc:date>2013-12-09T21:11:58Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating the Checksum on a local file</title>
      <link>https://forums.autodesk.com/t5/vault-customization-forum/calculating-the-checksum-on-a-local-file/m-p/4683511#M10755</link>
      <description>&lt;P&gt;&lt;SPAN&gt;"There are a variety of implementations of CRC32"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Couldn't&amp;nbsp;be more true&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp;"which should all produce the same result"&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;Couldn´t be more wrong ( Based on two days implementation of various algorithms before posting &amp;nbsp;)&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Why not&amp;nbsp;simply&amp;nbsp;provide this algorithm? Trespassing ADN territory?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&amp;nbsp;&lt;/PRE&gt;</description>
      <pubDate>Tue, 10 Dec 2013 08:01:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vault-customization-forum/calculating-the-checksum-on-a-local-file/m-p/4683511#M10755</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-12-10T08:01:26Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating the Checksum on a local file</title>
      <link>https://forums.autodesk.com/t5/vault-customization-forum/calculating-the-checksum-on-a-local-file/m-p/4685463#M10756</link>
      <description>&lt;P&gt;
I didn't realize that CRC32 had so many variants - sorry - I mistakenly assumed it was a standard like MD5 or SHA.
&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;
&lt;/P&gt;&lt;P&gt;
But I can't take the code we use in Vault and share it since it is Autodesk's copyrighted Intellectual Property. I would need permission from the lawyers first, and I'm not sure how to go about doing that.
&lt;/P&gt;&lt;BR /&gt;
&lt;P&gt;
Doug maintains a &lt;A href="http://justonesandzeros.typepad.com/" target="_blank"&gt;blog&lt;/A&gt; where he posts a variety of samples &amp;amp; tutorials. I recommend searching there.
&lt;/P&gt;&lt;BR /&gt;
&lt;P&gt;
-Dave
&lt;/P&gt;</description>
      <pubDate>Tue, 10 Dec 2013 22:40:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vault-customization-forum/calculating-the-checksum-on-a-local-file/m-p/4685463#M10756</guid>
      <dc:creator>minkd</dc:creator>
      <dc:date>2013-12-10T22:40:36Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating the Checksum on a local file</title>
      <link>https://forums.autodesk.com/t5/vault-customization-forum/calculating-the-checksum-on-a-local-file/m-p/4686089#M10757</link>
      <description>&lt;P&gt;Hi Dave.. Cool runnings.. &lt;A href="https://forums.autodesk.com/t5/Vault-Customization/API-Doug-s-checksum-function-doesn-t-seem-to-work-for-me/td-p/3093818" target="_self"&gt;Doug just entered the building&lt;/A&gt;&amp;nbsp;Let´s hope the lawyers lay low as it would be suicide to nail him&amp;nbsp;&lt;img id="smileywink" class="emoticon emoticon-smileywink" src="https://forums.autodesk.com/i/smilies/16x16_smiley-wink.png" alt="Smiley Wink" title="Smiley Wink" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Anyways : some more stubborn research led me to the origin of cadfish1´s "obfuscated" codesnippet that´s out of autodesk&amp;nbsp;&lt;SPAN&gt;jurisdiction:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.vbaccelerator.com/home/NET/Code/Libraries/CRC32/Crc32.asp" target="_blank"&gt;http://www.vbaccelerator.com/home/NET/Code/Libraries/CRC32/Crc32.asp&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The C# sample will play ball changing types from uint to long.&lt;/P&gt;</description>
      <pubDate>Wed, 11 Dec 2013 07:59:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vault-customization-forum/calculating-the-checksum-on-a-local-file/m-p/4686089#M10757</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-12-11T07:59:06Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating the Checksum on a local file</title>
      <link>https://forums.autodesk.com/t5/vault-customization-forum/calculating-the-checksum-on-a-local-file/m-p/7523300#M10758</link>
      <description>&lt;P&gt;Good afternoon, could you please update the link&amp;nbsp;&lt;A href="http://www.vbaccelerator.com/home/NET/Code/Libraries/CRC32/Crc32.asp" target="_blank" rel="nofollow noopener noreferrer"&gt;http://www.vbaccelerator.com/home/NET/Code/Libraries/CRC32/Crc32.asp&lt;/A&gt;, because this link doesn't work anymore.&lt;/P&gt;</description>
      <pubDate>Tue, 07 Nov 2017 11:04:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vault-customization-forum/calculating-the-checksum-on-a-local-file/m-p/7523300#M10758</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-11-07T11:04:04Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating the Checksum on a local file</title>
      <link>https://forums.autodesk.com/t5/vault-customization-forum/calculating-the-checksum-on-a-local-file/m-p/7543389#M10759</link>
      <description>&lt;P&gt;Imagine life&amp;nbsp;without&amp;nbsp;web.archive.org&amp;nbsp;&lt;img id="smileysurprised" class="emoticon emoticon-smileysurprised" src="https://forums.autodesk.com/i/smilies/16x16_smiley-surprised.png" alt="Smiley Surprised" title="Smiley Surprised" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;using System;
using System.IO;

namespace Vbaccelerator.Components.Algorithms
{
   /// &amp;lt;summary&amp;gt;
   /// Calculates a 32bit Cyclic Redundancy Checksum (CRC) using the
   /// same polynomial used by Zip.
   /// &amp;lt;/summary&amp;gt;
   public class CRC32
   {      
      private UInt32[] crc32Table;
      private const int BUFFER_SIZE = 1024;

      /// &amp;lt;summary&amp;gt;
      /// Returns the CRC32 for the specified stream.
      /// &amp;lt;/summary&amp;gt;
      /// &amp;lt;param name="stream"&amp;gt;The stream to calculate the CRC32 for&amp;lt;/param&amp;gt;
      /// &amp;lt;returns&amp;gt;An unsigned integer containing the CRC32
       calculation&amp;lt;/returns&amp;gt;
      public UInt32 GetCrc32(System.IO.Stream stream)
      {
         unchecked
         {
            UInt32 crc32Result;
            crc32Result = 0xFFFFFFFF;
            byte[] buffer = new byte[BUFFER_SIZE];
            int readSize = BUFFER_SIZE;

            int count = stream.Read(buffer, 0, readSize);
            while (count &amp;gt; 0)
            {
               for (int i = 0; i &amp;lt; count; i++)
               {
                  crc32Result = ((crc32Result) &amp;gt;&amp;gt; 8) ^ crc32Table[(buffer[i]) ^
                   ((crc32Result) &amp;amp; 0x000000FF)];
               }
               count = stream.Read(buffer, 0, readSize);
            }
            
            return ~crc32Result;
         }
      }

      /// &amp;lt;summary&amp;gt;
      /// Construct an instance of the CRC32 class, pre-initialising the table
      /// for speed of lookup.
      /// &amp;lt;/summary&amp;gt;
      public CRC32()
      {
         unchecked
         {
            // This is the official polynomial used by CRC32 in PKZip.
            // Often the polynomial is shown reversed as 0x04C11DB7.
            UInt32 dwPolynomial = 0xEDB88320;
            UInt32 i, j;

            crc32Table = new UInt32[256];

            UInt32 dwCrc;
            for(i = 0; i &amp;lt; 256; i++)
            {
               dwCrc = i;
               for(j = 8; j &amp;gt; 0; j--)
               {
                  if ((dwCrc &amp;amp; 1)==1)
                  {
                     dwCrc = (dwCrc &amp;gt;&amp;gt; 1) ^ dwPolynomial;
                  }
                  else
                  {
                     dwCrc &amp;gt;&amp;gt;= 1;
                  }
               }
               crc32Table[i] = dwCrc;
            }
         }
      }
   }
}&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Nov 2017 16:48:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vault-customization-forum/calculating-the-checksum-on-a-local-file/m-p/7543389#M10759</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-11-14T16:48:39Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating the Checksum on a local file</title>
      <link>https://forums.autodesk.com/t5/vault-customization-forum/calculating-the-checksum-on-a-local-file/m-p/7545740#M10760</link>
      <description>&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 15 Nov 2017 11:52:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vault-customization-forum/calculating-the-checksum-on-a-local-file/m-p/7545740#M10760</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-11-15T11:52:04Z</dc:date>
    </item>
  </channel>
</rss>

