Search results

  1. Skydiver

    HashLib4CSharp - Comprehensive Hashing Library written in C#

    For those following the thread, but not GitHub, the original Adler32 code looked something like this: [CODE lang="csharp" title="Original"]public override void TransformBytes(byte[] data, int index, int length) { if (data == null) throw new ArgumentNullException(nameof(data))...
  2. Skydiver

    HashLib4CSharp - Comprehensive Hashing Library written in C#

    In which case you'll like the pull request coming later today. After I made the perf for CRC-32 faster, I noticed that it is now running faster that the Adler32. Adler32 was running at about 685 on my PC. When Mark Adler invented it, he wanted something much faster than CRC32. I've got it...
  3. Skydiver

    HashLib4CSharp - Comprehensive Hashing Library written in C#

    Okay got better performance with the Span<T>: 692 and 690 respectively: [StructLayout(LayoutKind.Sequential, Pack = 4)] struct Block { public uint one; public uint two; public uint three; public uint four; } protected void LocalCrcCompute(uint[][] crcTable, byte[] data, int...
  4. Skydiver

    HashLib4CSharp - Comprehensive Hashing Library written in C#

    No problem. It's your library. I guess you'll just deal with any cases when someone figures out how to use your library to cause a buffer overwrite or an elevation of privilege when somebody reports it. Performance is king, that's why we still program in languages like C and C++... Security...
  5. Skydiver

    process.start more image

    Unfortunately that is not going to work. When you call Process.Start() giving it just a filename the default image viewer is launched by Windows and you don't have any control over that viewer that is launched. That viewer may not be the Win10 Photo Viewer. It may be Adobe. It may ACDSee. It may...
  6. Skydiver

    HashLib4CSharp - Comprehensive Hashing Library written in C#

    Yes, it is faster, but also more complex. Its still uses unsafe pointers. The reason I put in that statistic there was to show that using the Span<T> lets you have safer code, but the performance penalty is not that big. See pull Request #4. The relevant code is: protected unsafe void...
  7. Skydiver

    HashLib4CSharp - Comprehensive Hashing Library written in C#

    So here is a version of the CRC32 computation using Span<T>: protected void LocalCrcCompute(uint[][] crcTable, byte[] data, int index, int length) { if (data == null) throw new ArgumentNullHashLibException(nameof(data)); Debug.Assert(index >= 0); Debug.Assert(length >= 0)...
  8. Skydiver

    HashLib4CSharp - Comprehensive Hashing Library written in C#

    I saw that you picked up the 2 pull requests I sent last night regarding the performance test UI. I'll probably get around to doing a pull from your repo soon. I've been busy debugging the CRC32 code because my Span implementation was failing the unit tests. Just figured it about 5 minutes ago...
  9. Skydiver

    HashLib4CSharp - Comprehensive Hashing Library written in C#

    I would suggest just to keep it simple: /* HashLib4CSharp Library Copyright (c) 2020 Ugochukwu Mmaduekwe GitHub Profile URL <https://github.com/Xor-el> Distributed under the MIT software license, see the accompanying LICENSE file or visit http://www.opensource.org/licenses/mit-license.php...
  10. Skydiver

    HashLib4CSharp - Comprehensive Hashing Library written in C#

    I tend to use ArgumentException and put a more detailed message about why an argument was invalid. It only in the cases when I need to let the caller be able to distinguish between multiple different kinds of ArgumentException's that may result from a single line of code that I create a custom...
  11. Skydiver

    HashLib4CSharp - Comprehensive Hashing Library written in C#

    Also that Pascal and C style large comment block is not recommended in the C# coding conventions:
  12. Skydiver

    HashLib4CSharp - Comprehensive Hashing Library written in C#

    Also there is a lot of use of unsafe pointers in the code. I've only done a brief scan so far, but I believe a majority of it can be replaced with using Span<byte> so that you don't have to compile with the unsafe flag on.
  13. Skydiver

    HashLib4CSharp - Comprehensive Hashing Library written in C#

    @Xor-el : Why did you define your own exceptions here: /* (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) { * HashLib4CSharp Library * } { * Copyright (c) 2020 Ugochukwu...
  14. Skydiver

    HashLib4CSharp - Comprehensive Hashing Library written in C#

    So this is an official port as compared to SharpHash by @ron4fun that he announced in this forum last year?
  15. Skydiver

    Help with KeyboardUtility class

    Give this a spin: static bool GetYesNo(string prompt) { Console.Write($"{prompt} [Y/N]: "); while (true) { char ch = Console.ReadKey(true).KeyChar; switch (char.ToUpper(ch)) { case 'Y': case 'N': Console.WriteLine(ch)...
  16. Skydiver

    Five records to display on the label sequentially

    I hope that your plan to do that dynamic display is not going to be very accessible to people with vision disabilities why they are using your application. A screen reader that the user is using may not be able to identify that you've updated a label and be able to read out the new text in time.
  17. Skydiver

    Question Deleting drawn figures

    Can we assume that the code that draws the shapes uses the _shapes list? Later as you advance through your programming skills, you will encounter the Command pattern which is the generally accepted way to deal with situations like this. But design patterns are kind of esoteric until you've got...
  18. Skydiver

    Question Deleting drawn figures

    I've moved the new question to a new thread.
  19. Skydiver

    Question Simple console; save, show & delete items and exit (Backpack)

    What is the problem? Are you getting an error? If you aren't getting an error, what behaviour are you seeing? What behaviour were you expecting to see?
  20. Skydiver

    Help with KeyboardUtility class

    And a do-while version of post #3: public static class ConsoleInputHelper { public static int GetInt32(string prompt) { do { Console.WriteLine(prompt); if (int.TryParse(Console.ReadLine(), out var number)) return number...
Top Bottom