IChecksum.cs 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. namespace ICSharpCode.SharpZipLib.Checksum
  2. {
  3. /// <summary>
  4. /// Interface to compute a data checksum used by checked input/output streams.
  5. /// A data checksum can be updated by one byte or with a byte array. After each
  6. /// update the value of the current checksum can be returned by calling
  7. /// <code>getValue</code>. The complete checksum object can also be reset
  8. /// so it can be used again with new data.
  9. /// </summary>
  10. public interface IChecksum
  11. {
  12. /// <summary>
  13. /// Resets the data checksum as if no update was ever called.
  14. /// </summary>
  15. void Reset();
  16. /// <summary>
  17. /// Returns the data checksum computed so far.
  18. /// </summary>
  19. long Value {
  20. get;
  21. }
  22. /// <summary>
  23. /// Adds one byte to the data checksum.
  24. /// </summary>
  25. /// <param name = "bval">
  26. /// the data value to add. The high byte of the int is ignored.
  27. /// </param>
  28. void Update(int bval);
  29. /// <summary>
  30. /// Updates the data checksum with the bytes taken from the array.
  31. /// </summary>
  32. /// <param name="buffer">
  33. /// buffer an array of bytes
  34. /// </param>
  35. void Update(byte[] buffer);
  36. /// <summary>
  37. /// Adds the byte array to the data checksum.
  38. /// </summary>
  39. /// <param name = "buffer">
  40. /// The buffer which contains the data
  41. /// </param>
  42. /// <param name = "offset">
  43. /// The offset in the buffer where the data starts
  44. /// </param>
  45. /// <param name = "count">
  46. /// the number of data bytes to add.
  47. /// </param>
  48. void Update(byte[] buffer, int offset, int count);
  49. }
  50. }