3
Contributors
2
Replies
19
Views
4 Months
Discussion Span
Last Post by overwraith
0

As a student you would know how to research. That is, use google, wikipedia and more. What else you need to know is how to ask questions here. Please read https://www.daniweb.com/programming/threads/435023/read-this-before-posting-a-question

Back to your work at hand. You have a concept that has been done before so what is the goal here? Make a wheel or try to build it from scratch so you understand how it all works from the ground up?

It's unclear what your question here is. Be sure to ask the question after you read the link I supplied. Be sure to write it as a question that is followed by the usual question mark.

0

I hope it is not too intrusive for me to provide a little sample code... The object relational mapper would probably be your own responsibility. Object relational mappers pull objects out of the database and map them to properties in your objects, the model. You would have to determine the resulting byte array lengths and then create a table in the database with those byte array lengths, you could also do that on the fly with nhibernate creating the table for you.

        /// <summary>
        /// Object to be saved to database. 
        /// </summary>
        public class MyObject {
            /// <summary>
            /// Fingerprint to save to database. 
            /// </summary>
            public byte[] Fingerprint {
                get; set;
            }

            public MyObject() {

            }

            /// <summary>
            /// Set the fingerprint byte array object. 
            /// </summary>
            public void SetFingerprint(Stream stream) {
                using (HashAlgorithm hash = CreateHashAlgorithim()) {
                    Fingerprint = hash.ComputeHash(stream);
                }
            }//end method

            public HashAlgorithm CreateHashAlgorithim() {
                //options md5, sha1, and sha512
                return MD5.Create();
            }//end method
        }//end class
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.