01:07:45 | * | rockcavera quit (Remote host closed the connection) |
01:13:44 | * | rockcavera joined #nim |
02:33:07 | FromDiscord | <systemblue2010> this is my code that working with SHA-1 stream and onetime hashing https://media.discordapp.net/attachments/371759389889003532/1430021052452442134/message.txt?ex=68f84263&is=68f6f0e3&hm=e1ef6612a57a23588d395c15205bcf8443ccd9402895208d0f0c667ba5c5095e& |
02:34:15 | * | rockcavera quit (Remote host closed the connection) |
02:35:03 | FromDiscord | <systemblue2010> sent a long message, see https://pasty.ee/aWCcMqar |
02:35:11 | FromDiscord | <systemblue2010> something was wrong... |
02:35:30 | FromDiscord | <systemblue2010> but I made this same with RFC's C code |
02:56:01 | * | LuckyMan joined #nim |
03:35:22 | FromDiscord | <janakali> @systemblue2010 SHA-1 is big endian, that's probably your issue |
03:50:12 | * | SchweinDeBurg quit (Quit: WeeChat 4.8.0-dev) |
03:56:49 | FromDiscord | <systemblue2010> In reply to @janakali "<@1424216909766983721> SHA-1 is big": I'm using bigendian |
03:57:32 | * | LuckyMan quit (Quit: LuckyMan) |
04:22:23 | * | SchweinDeBurg joined #nim |
06:39:25 | * | kenran joined #nim |
06:51:17 | * | tokyovigilante quit (Remote host closed the connection) |
07:43:57 | FromDiscord | <kiloneie> How do i multiple type return ? https://github.com/alaviss/union/ ? I recall something about tuples... tuple ? https://media.discordapp.net/attachments/371759389889003532/1430099271150993500/Screenshot_2025-10-21_09-42-21.png?ex=68f88b3c&is=68f739bc&hm=b956c3795b59b4502682c9a74bc04b44433ed042b3a40698aa4956534392e7a0& |
07:52:55 | * | xet7 joined #nim |
07:57:01 | * | xet7 quit (Remote host closed the connection) |
08:03:09 | FromDiscord | <tauruuuuuus> In reply to @kiloneie "How do i multiple": https://play.nim-lang.org/#pasty=nPNfcXjP↵Depending on if you meant multiple returns or a single return with multiple possible types, this specifies the type at comptime through the generic instantiation, if you want it a runtime I guess you have to use an object variant |
08:08:59 | FromDiscord | <systemblue2010> In reply to @janakali "<@1424216909766983721> SHA-1 is big": I don't know what's wrong\ |
08:16:28 | FromDiscord | <tauruuuuuus> In reply to @systemblue2010 "this is my code": If you need a reference implementation or just a sha1 impl that works, I have done one some time ago for some examples and bootloader validation, you can use it to check it against yours ↵https://github.com/Abathargh/avr_io/blob/master/examples/bootloader/src/sha1.nim |
08:18:15 | FromDiscord | <systemblue2010> In reply to @tauruuuuuus "If you need a": nono I'm studying↵so I need to make it with my method↵I know there's nim-lang/checksum library in git |
08:18:33 | FromDiscord | <amun0666> @systemblue2010 Skimming at the code… it seems you don't have a separate finish step. |
08:18:51 | FromDiscord | <systemblue2010> but their implement method was not same with me |
08:19:13 | FromDiscord | <systemblue2010> did you download my code? |
08:19:25 | FromDiscord | <tauruuuuuus> In reply to @systemblue2010 "nono I'm studying so": that is not the checksum one, this is small and good for constrained devices too, anyways I get it, what i did and what I would tell you to do is to closely follow the RFC description and just have some known test cases to test it out |
08:19:35 | FromDiscord | <tauruuuuuus> having a reference that works can help with small mistakes |
08:19:57 | FromDiscord | <systemblue2010> I don't have nitro so I can't upload full text so I upload with file↵and ↵i have finish step |
08:19:58 | FromDiscord | <amun0666> This pseudo code is pretty clear too: https://en.wikipedia.org/wiki/SHA-1 |
08:20:41 | FromDiscord | <systemblue2010> In reply to @amun0666 "This pseudo code is": this only give me hints of onetime sha1 code(I make this by seeing wikipedia) |
08:21:18 | FromDiscord | <systemblue2010> In reply to @amun0666 "This pseudo code is": the onetime hash that I made works fine |
08:21:24 | FromDiscord | <systemblue2010> but second, stream hash works wrong |
08:22:17 | FromDiscord | <tauruuuuuus> https://datatracker.ietf.org/doc/html/rfc3174↵You should use the RFC as a basis |
08:22:23 | Amun-Ra | you have to hash the plaintext length in the final step |
08:23:03 | FromDiscord | <amun0666> check the RFC https://datatracker.ietf.org/doc/html/rfc3174 |
08:23:10 | FromDiscord | <amun0666> SHA1PadMessage |
08:23:46 | FromDiscord | <amun0666> this must be done once at the last step, once you do this, you can't update anymore |
08:24:55 | FromDiscord | <amun0666> https://media.discordapp.net/attachments/371759389889003532/1430109583086719096/image.png?ex=68f894d6&is=68f74356&hm=289cff9e27bb11d9aca381f556505c96bbbfceac2c934599efbcc1dda38ae6dd& |
08:25:23 | FromDiscord | <amun0666> And that's why common APIs contain: update and final methods |
08:27:05 | FromDiscord | <amun0666> it's been a while since I implemented my own sha-1 😉 |
08:27:31 | FromDiscord | <tauruuuuuus> alwys dun 😄 |
08:27:35 | FromDiscord | <tauruuuuuus> (edit) "alwys dun" => "always fun" |
08:27:40 | FromDiscord | <amun0666> true 😛 |
08:33:28 | FromDiscord | <amun0666> found it, this is a very old code, don't shoot the messenger: https://play.nim-lang.org/#pasty=letgVlGj |
08:34:36 | * | beholders_eye joined #nim |