<< 21-10-2025 >>

01:07:45*rockcavera quit (Remote host closed the connection)
01:13:44*rockcavera joined #nim
02:33:07FromDiscord<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:03FromDiscord<systemblue2010> sent a long message, see https://pasty.ee/aWCcMqar
02:35:11FromDiscord<systemblue2010> something was wrong...
02:35:30FromDiscord<systemblue2010> but I made this same with RFC's C code
02:56:01*LuckyMan joined #nim
03:35:22FromDiscord<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:49FromDiscord<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:57FromDiscord<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:09FromDiscord<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:59FromDiscord<systemblue2010> In reply to @janakali "<@1424216909766983721> SHA-1 is big": I don't know what's wrong\
08:16:28FromDiscord<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:15FromDiscord<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:33FromDiscord<amun0666> @systemblue2010 Skimming at the code… it seems you don't have a separate finish step.
08:18:51FromDiscord<systemblue2010> but their implement method was not same with me
08:19:13FromDiscord<systemblue2010> did you download my code?
08:19:25FromDiscord<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:35FromDiscord<tauruuuuuus> having a reference that works can help with small mistakes
08:19:57FromDiscord<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:58FromDiscord<amun0666> This pseudo code is pretty clear too: https://en.wikipedia.org/wiki/SHA-1
08:20:41FromDiscord<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:18FromDiscord<systemblue2010> In reply to @amun0666 "This pseudo code is": the onetime hash that I made works fine
08:21:24FromDiscord<systemblue2010> but second, stream hash works wrong
08:22:17FromDiscord<tauruuuuuus> https://datatracker.ietf.org/doc/html/rfc3174↵You should use the RFC as a basis
08:22:23Amun-Rayou have to hash the plaintext length in the final step
08:23:03FromDiscord<amun0666> check the RFC https://datatracker.ietf.org/doc/html/rfc3174
08:23:10FromDiscord<amun0666> SHA1PadMessage
08:23:46FromDiscord<amun0666> this must be done once at the last step, once you do this, you can't update anymore
08:24:55FromDiscord<amun0666> https://media.discordapp.net/attachments/371759389889003532/1430109583086719096/image.png?ex=68f894d6&is=68f74356&hm=289cff9e27bb11d9aca381f556505c96bbbfceac2c934599efbcc1dda38ae6dd&
08:25:23FromDiscord<amun0666> And that's why common APIs contain: update and final methods
08:27:05FromDiscord<amun0666> it's been a while since I implemented my own sha-1 😉
08:27:31FromDiscord<tauruuuuuus> alwys dun 😄
08:27:35FromDiscord<tauruuuuuus> (edit) "alwys dun" => "always fun"
08:27:40FromDiscord<amun0666> true 😛
08:33:28FromDiscord<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
08:39:27FromDiscord<tauruuuuuus> I don't have the willpower to read it all now but skimming through it i don't see anything bad lol maybe my coworkers code have lowered my standards...
08:39:32FromDiscord<tauruuuuuus> jkjk 😛
08:40:55FromDiscord<amun0666> 😄
09:10:43FromDiscord<systemblue2010> In reply to @tauruuuuuus "https://datatracker.ietf.org/doc/html/rfc3174 You s": yes I use RFC
09:22:38FromDiscord<mtriplet> Idk if it is not off topic but I can't install nico ( Nim version of Pico-8 )
09:27:13FromDiscord<systemblue2010> In reply to @amun0666 "this must be done": it's only worked once
10:39:16*kenran quit (Ping timeout: 246 seconds)
10:42:00*beholders_eye quit (Quit: WeeChat 4.6.3)
10:49:23*beholders_eye joined #nim
12:02:35FromDiscord<kiloneie> In reply to @tauruuuuuus "https://play.nim-lang.org/#pasty=nPNfcXjP Depending": How would that look like with an object variant ?...
12:03:19FromDiscord<kiloneie> boolOrEntity = object case kind: bool, Entity ?
12:04:25*vsantana joined #nim
12:05:40FromDiscord<amun0666> For example https://play.nim-lang.org/#pasty=HPrcEICD
12:12:24FromDiscord<kiloneie> I can't just overload it... ugh, this is ugly...
12:13:08Amun-Rayou cannot
12:13:28Amun-Rayou can only set kind on object creation
12:13:30Amun-Rait doesn
12:13:38Amun-Rait doesn't work like C union
12:15:12FromDiscord<kiloneie> How wasteful would it be to return (true, instance), on collision check everytime ?
12:17:29FromDiscord<amun0666> tbh not very wasteful
12:17:40FromDiscord<amun0666> depends on the instance size and type
12:18:13FromDiscord<amun0666> (bool, int32) would find into a single register / or pair (I haven't looked into nim's internals tho)
12:24:03FromDiscord<kiloneie> Hmm, might do it then, but first, i have to object variant my collision procs, just thought of that D:.
12:24:54FromDiscord<amun0666> Remember, premature optimization is a root of all evil… 😉
12:25:12FromDiscord<kiloneie> Wait, a tuple can ommit one of it's fields, wouldn't it be returning only 1 type if i so chose ?
12:26:13FromDiscord<kiloneie> In reply to @amun0666 "Remember, premature optimization is": I know i know, but i try to at least give it a minute of thought or two, because this is a LONG term project, and my own game engine, i have to be, more careful than some throw away single file programs.
12:30:48FromDiscord<amun0666> and remember - you can't share attribute name between different kinds
12:31:03FromDiscord<amun0666> I mean a field
12:31:21FromDiscord<amun0666> you can have a common field for all kind but you can't have the same field name for different kinds
12:31:59FromDiscord<amun0666> https://play.nim-lang.org/#pasty=xcfGdTsl
12:32:58FromDiscord<amun0666> btw, if you only need boolean status you can wrap instance with Option
12:38:26FromDiscord<kiloneie> I am already using object variants for collisionMask.
12:38:53FromDiscord<kiloneie> Based on that, my collisionDetection procs will change too(placeholders)
12:39:24FromDiscord<kiloneie> Taking a lot of inspiration from GameMaker
12:39:33Amun-Rain my current project I use something like: proc someproc(o: var ObjectToReturn): Result (Result being an enum)
12:41:45*kubrat joined #nim
13:08:26FromDiscord<0xfab_10> afaik in c++ you should prefer to return values instead of using out variables because llvm gets lobotomized on memory access across function calls
13:08:32FromDiscord<0xfab_10> and can't optimize as well
13:09:56FromDiscord<amun0666> I almost never use C++ backend.
13:10:10FromDiscord<0xfab_10> well clang uses llvm for both c and c++
13:10:22FromDiscord<0xfab_10> so idk I bet it's the same thing in both places
13:11:48FromDiscord<amun0666> Speaking of gcc in clang, release build using gcc is 3.8MB, clang - 3.4MB. Nice.
13:12:01FromDiscord<amun0666> I mean, release build of my util.
13:30:42*kubrat quit (Quit: Client closed)
13:50:02FromDiscord<kiloneie> Do words start with a capital letter, when in parenthesis ? https://media.discordapp.net/attachments/371759389889003532/1430191397528535225/Screenshot_2025-10-21_15-49-28.png?ex=68f8e108&is=68f78f88&hm=c96f4a9bae61882174b6ffc2c3f543ebbefbe33900d2b4701b58a3fcf90dd7c7&
13:52:04FromDiscord<amun0666> In english? Yes.
14:01:26FromDiscord<0xfab_10> not always?
14:02:33FromDiscord<amun0666> But in this context? That sentence lacks a period tho.
14:12:41FromDiscord<nervecenter> sent a code paste, see https://play.nim-lang.org/#pasty=QvWvvwZZ
14:12:55FromDiscord<nervecenter> (edit) "https://play.nim-lang.org/#pasty=SwpsaMfP" => "https://play.nim-lang.org/#pasty=EUMBYxbO"
14:13:45FromDiscord<nervecenter> Hm, enums can be strings...maybe I could just use an enum type
14:14:50FromDiscord<0xfab_10> I would rather throw an exception or defect than quit like that
14:15:23Amun-Raan exception to the user?
14:16:36FromDiscord<nervecenter> In reply to @fabric.input_output "I would rather throw": Probably a good idea as a first step
14:17:01Amun-Rathat code looked like a fragment of cli argument parsing
14:20:17FromDiscord<nervecenter> There's a few places where I use it and it definitely doesn't seem appropriate for those
14:20:36Amun-Ranobody reads commit messages ;)
14:20:39FromDiscord<nervecenter> Throwing seems like the better option
14:20:50Amun-Raah, wrong subchannel
14:21:05FromDiscord<nervecenter> oh alright
15:12:24*xtr00_ quit (Ping timeout: 244 seconds)
15:12:50*xtr00 joined #nim
15:22:30*xtr00 quit (Ping timeout: 265 seconds)
15:25:41FromDiscord<kiloneie> `if instancePlace(entityWall, (x: mousePosition.x.float, y: mousePosition.y.float)) == (true, ):`↵How do i do this with a tuple return ?
15:27:54*xtr00 joined #nim
15:34:52FromDiscord<Elegantbeef> `if instancePlace(...)[0]`
15:44:44FromDiscord<lainlaylie> sent a code paste, see https://play.nim-lang.org/#pasty=CtTOWWEI
15:45:40FromDiscord<lainlaylie> (edit) "https://play.nim-lang.org/#pasty=ofYRcVGP" => "https://play.nim-lang.org/#pasty=hYqkVTvL"
15:46:06FromDiscord<nervecenter> I'd love it if `case` had at the very least static tuple matching, if not binding. But yeah, binding beforehand is an okay approach.
15:46:33FromDiscord<0xfab_10> the children yearn for pattern matching
15:48:59FromDiscord<Elegantbeef> Cmon now we can have the ugly `if (let (ok, _) = instancePlace(...); ok)`
15:49:37FromDiscord<lainlaylie> thats `ok` i guess
16:08:43FromDiscord<nasuray> In reply to @nervecenter "I'd love it if": Bring your own with case stmt macros!
16:14:12FromDiscord<0xfab_10> In reply to @Elegantbeef "Cmon now we can": rob pike's soul haunts that piece of code
16:16:46FromDiscord<Elegantbeef> Pike wishes he could write something that nice
16:28:46FromDiscord<nervecenter> In reply to @nasuray "Bring your own with": I'm macro-allergic 😂
16:35:35FromDiscord<nasuray> sent a code paste, see https://play.nim-lang.org/#pasty=vaQQlrwB
16:44:40FromDiscord<tauruuuuuus> In reply to @lainlaylie "i find accessing tuple": also love named tuples personally