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 |
08:39:27 | FromDiscord | <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:32 | FromDiscord | <tauruuuuuus> jkjk 😛 |
08:40:55 | FromDiscord | <amun0666> 😄 |
09:10:43 | FromDiscord | <systemblue2010> In reply to @tauruuuuuus "https://datatracker.ietf.org/doc/html/rfc3174 You s": yes I use RFC |
09:22:38 | FromDiscord | <mtriplet> Idk if it is not off topic but I can't install nico ( Nim version of Pico-8 ) |
09:27:13 | FromDiscord | <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:35 | FromDiscord | <kiloneie> In reply to @tauruuuuuus "https://play.nim-lang.org/#pasty=nPNfcXjP Depending": How would that look like with an object variant ?... |
12:03:19 | FromDiscord | <kiloneie> boolOrEntity = object case kind: bool, Entity ? |
12:04:25 | * | vsantana joined #nim |
12:05:40 | FromDiscord | <amun0666> For example https://play.nim-lang.org/#pasty=HPrcEICD |
12:12:24 | FromDiscord | <kiloneie> I can't just overload it... ugh, this is ugly... |
12:13:08 | Amun-Ra | you cannot |
12:13:28 | Amun-Ra | you can only set kind on object creation |
12:13:30 | Amun-Ra | it doesn |
12:13:38 | Amun-Ra | it doesn't work like C union |
12:15:12 | FromDiscord | <kiloneie> How wasteful would it be to return (true, instance), on collision check everytime ? |
12:17:29 | FromDiscord | <amun0666> tbh not very wasteful |
12:17:40 | FromDiscord | <amun0666> depends on the instance size and type |
12:18:13 | FromDiscord | <amun0666> (bool, int32) would find into a single register / or pair (I haven't looked into nim's internals tho) |
12:24:03 | FromDiscord | <kiloneie> Hmm, might do it then, but first, i have to object variant my collision procs, just thought of that D:. |
12:24:54 | FromDiscord | <amun0666> Remember, premature optimization is a root of all evil… 😉 |
12:25:12 | FromDiscord | <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:13 | FromDiscord | <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:48 | FromDiscord | <amun0666> and remember - you can't share attribute name between different kinds |
12:31:03 | FromDiscord | <amun0666> I mean a field |
12:31:21 | FromDiscord | <amun0666> you can have a common field for all kind but you can't have the same field name for different kinds |
12:31:59 | FromDiscord | <amun0666> https://play.nim-lang.org/#pasty=xcfGdTsl |
12:32:58 | FromDiscord | <amun0666> btw, if you only need boolean status you can wrap instance with Option |
12:38:26 | FromDiscord | <kiloneie> I am already using object variants for collisionMask. |
12:38:53 | FromDiscord | <kiloneie> Based on that, my collisionDetection procs will change too(placeholders) |
12:39:24 | FromDiscord | <kiloneie> Taking a lot of inspiration from GameMaker |
12:39:33 | Amun-Ra | in 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:26 | FromDiscord | <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:32 | FromDiscord | <0xfab_10> and can't optimize as well |
13:09:56 | FromDiscord | <amun0666> I almost never use C++ backend. |
13:10:10 | FromDiscord | <0xfab_10> well clang uses llvm for both c and c++ |
13:10:22 | FromDiscord | <0xfab_10> so idk I bet it's the same thing in both places |
13:11:48 | FromDiscord | <amun0666> Speaking of gcc in clang, release build using gcc is 3.8MB, clang - 3.4MB. Nice. |
13:12:01 | FromDiscord | <amun0666> I mean, release build of my util. |
13:30:42 | * | kubrat quit (Quit: Client closed) |
13:50:02 | FromDiscord | <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:04 | FromDiscord | <amun0666> In english? Yes. |
14:01:26 | FromDiscord | <0xfab_10> not always? |
14:02:33 | FromDiscord | <amun0666> But in this context? That sentence lacks a period tho. |
14:12:41 | FromDiscord | <nervecenter> sent a code paste, see https://play.nim-lang.org/#pasty=QvWvvwZZ |
14:12:55 | FromDiscord | <nervecenter> (edit) "https://play.nim-lang.org/#pasty=SwpsaMfP" => "https://play.nim-lang.org/#pasty=EUMBYxbO" |
14:13:45 | FromDiscord | <nervecenter> Hm, enums can be strings...maybe I could just use an enum type |
14:14:50 | FromDiscord | <0xfab_10> I would rather throw an exception or defect than quit like that |
14:15:23 | Amun-Ra | an exception to the user? |
14:16:36 | FromDiscord | <nervecenter> In reply to @fabric.input_output "I would rather throw": Probably a good idea as a first step |
14:17:01 | Amun-Ra | that code looked like a fragment of cli argument parsing |
14:20:17 | FromDiscord | <nervecenter> There's a few places where I use it and it definitely doesn't seem appropriate for those |
14:20:36 | Amun-Ra | nobody reads commit messages ;) |
14:20:39 | FromDiscord | <nervecenter> Throwing seems like the better option |
14:20:50 | Amun-Ra | ah, wrong subchannel |
14:21:05 | FromDiscord | <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:41 | FromDiscord | <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:52 | FromDiscord | <Elegantbeef> `if instancePlace(...)[0]` |
15:44:44 | FromDiscord | <lainlaylie> sent a code paste, see https://play.nim-lang.org/#pasty=CtTOWWEI |
15:45:40 | FromDiscord | <lainlaylie> (edit) "https://play.nim-lang.org/#pasty=ofYRcVGP" => "https://play.nim-lang.org/#pasty=hYqkVTvL" |
15:46:06 | FromDiscord | <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:33 | FromDiscord | <0xfab_10> the children yearn for pattern matching |
15:48:59 | FromDiscord | <Elegantbeef> Cmon now we can have the ugly `if (let (ok, _) = instancePlace(...); ok)` |
15:49:37 | FromDiscord | <lainlaylie> thats `ok` i guess |
16:08:43 | FromDiscord | <nasuray> In reply to @nervecenter "I'd love it if": Bring your own with case stmt macros! |
16:14:12 | FromDiscord | <0xfab_10> In reply to @Elegantbeef "Cmon now we can": rob pike's soul haunts that piece of code |
16:16:46 | FromDiscord | <Elegantbeef> Pike wishes he could write something that nice |
16:28:46 | FromDiscord | <nervecenter> In reply to @nasuray "Bring your own with": I'm macro-allergic 😂 |
16:35:35 | FromDiscord | <nasuray> sent a code paste, see https://play.nim-lang.org/#pasty=vaQQlrwB |
16:44:40 | FromDiscord | <tauruuuuuus> In reply to @lainlaylie "i find accessing tuple": also love named tuples personally |