ChanServ changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.30.1 | Fund Crystal's development: http://is.gd/X7PRtI | GH: https://github.com/crystal-lang/crystal | Docs: http://crystal-lang.org/docs/ | API: http://crystal-lang.org/api/ | Gitter: https://gitter.im/crystal-lang/crystal
<FromGitter> <nsuchy> any ideas?
<FromGitter> <Blacksmoke16> i think you want to use `.create` not `.new`
<FromGitter> <asterite> we really need some convenience methods around these things
<FromGitter> <Daniel-Worrall> I agree
<FromGitter> <nsuchy> So I figured out how to create a password object from the hash
<FromGitter> <nsuchy> so that part is solved
<FromGitter> <Blacksmoke16> ok
<FromGitter> <nsuchy> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5d82c8c9901bb84d90316c8e]
<FromGitter> <nsuchy> so here's where I'm at
<FromGitter> <Blacksmoke16> i still dont think thats how it works
<FromGitter> <nsuchy> how should it work then?
<FromGitter> <Blacksmoke16> you would want to use `.create`
<FromGitter> <Blacksmoke16> which creates a bcrypt hash from your bleta hmac string
<FromGitter> <nsuchy> no the string above
<FromGitter> <nsuchy> is a bcrypt hash
<FromGitter> <nsuchy> from the hmac string
<FromGitter> <nsuchy> it's already a hash
<FromGitter> <nsuchy> we don't need a new hash
<FromGitter> <nsuchy> just to hook crystal to the php bcrypt hash
<FromGitter> <Blacksmoke16> ah
<FromGitter> <Blacksmoke16> what happens if you compare the hmac strings?
<FromGitter> <Blacksmoke16> assuming they're the same?
<FromGitter> <nsuchy> .new loads a hash
<FromGitter> <nsuchy> .create hashes a password
<FromGitter> <nsuchy> so using .new is correct
sagax has quit [Remote host closed the connection]
<FromGitter> <nsuchy> if we bcrypt hash the password and compare normally it's fine
<FromGitter> <nsuchy> so the issue I think is how the HMAC is being generated
<FromGitter> <Blacksmoke16> dunno
<FromGitter> <Blacksmoke16> make sure the hmac strings match
<FromGitter> <nsuchy> I have no way of accessing the HMAC string
<FromGitter> <nsuchy> it's hashed in mysql
<FromGitter> <nsuchy> it's one way
<FromGitter> <Blacksmoke16> do you know how its encoded?
<FromGitter> <Blacksmoke16> some php function i assume?
<FromGitter> <Blacksmoke16> `hash_hmac('sha256', 'monkey123', 'secret')` produces same hash as crystal
<FromGitter> <nsuchy> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5d82cb8d5ab9361694182e42]
<FromGitter> <nsuchy> This is how php does it
<FromGitter> <Blacksmoke16> the docs say `PASSWORD_BCRYPT` uses blowfish
<FromGitter> <nsuchy> wow
<FromGitter> <nsuchy> ...
<FromGitter> <nsuchy> tf
<FromGitter> <Blacksmoke16> thats prob your issue :p
<FromGitter> <nsuchy> how would I go about verifying a blowfish hash?
<FromGitter> <nsuchy> there's no pretty helper methods compared to the bcrypt one
sagax has joined #crystal-lang
<FromGitter> <Blacksmoke16> :shrug: gl
<FromGitter> <nsuchy> BCRYPT == Blowfish according to php
<FromGitter> <nsuchy> total fucking sense
<FromGitter> <nsuchy> watch one of the devs say, but nathan Bcrypt stands for Blowfish Crypt
<FromGitter> <nsuchy> not the Bcrypt algo you love
<FromGitter> <Blacksmoke16> if that means anything to you
<FromGitter> <Daniel-Worrall> Php makes sense. Mhm.
<FromGitter> <nsuchy> @Daniel-Worrall april fools
<FromGitter> <nsuchy> 😂
<FromGitter> <nsuchy> the spec makes no sense
<FromGitter> <nsuchy> not even php can work with the hashes except as part of blesta
<FromGitter> <nsuchy> Might have to see if Blesta has an SSO-like plugin
<FromGitter> <nsuchy> which could pass a key to the crystal panel
<FromGitter> <Daniel-Worrall> Looks like you're passing in the wrong args
f1refly has joined #crystal-lang
f1reflyylmao has quit [Ping timeout: 276 seconds]
chemist69 has quit [Ping timeout: 276 seconds]
chemist69 has joined #crystal-lang
chachasmooth has quit [Ping timeout: 245 seconds]
chachasmooth has joined #crystal-lang
<FromGitter> <watzon> Anyone have any thoughts about this? https://github.com/crystal-lang/crystal/issues/8199
ht_ has joined #crystal-lang
_whitelogger has joined #crystal-lang
ht_ has quit [Remote host closed the connection]
<FromGitter> <elorest> I'm running into some weird issues from a change that was introduced in 0.27.1. ⏎ ⏎ Previously this code worked just fine but now it throws an error in >= 0.27.1 ⏎ https://carc.in/#/r/7lfy ⏎ ... [https://gitter.im/crystal-lang/crystal?at=5d830fdf04053c5b3d822081]
<FromGitter> <elorest> https://carc.in/#/r/7lg9 works just fine on MacOS with Crystal 0.30.1 but fails in Linux and carc.in.
<FromGitter> <elorest> I'm running into some weird issues from a change that was introduced in 0.27.1. ⏎ ⏎ Previously this code worked just fine but now it throws an error in >= 0.27.1 ⏎ https://carc.in/#/r/7lg9 ⏎ ... [https://gitter.im/crystal-lang/crystal?at=5d83164ba38dae3a637aee2f]
<FromGitter> <watzon> @elorest integer overflow checking was added recently. You need to convert those to Int64s
<FromGitter> <watzon> https://carc.in/#/r/7lgw
early has quit [Quit: Leaving]
<FromGitter> <bararchy> How do I get the actual error of `Errno` type exception? (like `EWOULDBLOCK` etc..) it seems calling `.class` just returns `Errno`
absolutejam has joined #crystal-lang
early has joined #crystal-lang
<FromGitter> <elorest> @watzon that's the solution I ended up going with. I'm still a bit concerned that it works on MacOS though. Should they both overflow at the same time?
absolutejam has quit [Ping timeout: 246 seconds]
<FromGitter> <naqvis> @bararchy doesn't the `#errno` and `errno_message` works? https://crystal-lang.org/api/0.30.1/Errno.html
return0e has quit [Ping timeout: 250 seconds]
<FromGitter> <bararchy> @naqvis ohhhh #errno , got it :)
return0e has joined #crystal-lang
<FromGitter> <naqvis> :)
absolutejam has joined #crystal-lang
<FromGitter> <bararchy> hmmm it seems to return an Int
<FromGitter> <bararchy> I want to get back the specific class name
<FromGitter> <didactic-drunk> Then it wouldn't be an exception and you couldn't throw it.
<FromGitter> <bararchy> don't we have a way to `.subclass` or something like that? XD
<FromGitter> <bararchy> because `.is_a?()` identify the relevant variant
<FromGitter> <didactic-drunk> Do you mean each `class Errno::ENOENT < Errno`?
<FromGitter> <bararchy> yeha
<FromGitter> <bararchy> I just want to print out which `Errno::*` was raised
<FromGitter> <didactic-drunk> `ex.errno`
<FromGitter> <j8r> I noticed `LibC::ENOTBLK` isn't defined
<FromGitter> <didactic-drunk> Should you be able to rescue `Errno::INDIVIDUALLY`? That doesn't seem possible.
<FromGitter> <j8r> https://carc.in/#/r/7lj9 😕
<FromGitter> <j8r> I open an issue about missing constants: `ENOTBLK ESOCKTNOSUPPORT EPFNOSUPPORT ESHUTDOWN ETOOMANYREFS EHOSTDOWN EUSERS EREMOTE`
<FromGitter> <bararchy> @j8r lol yeha, I tried to make an enum and saw it was missing, how the hell does that compile?
<FromGitter> <bararchy> @didactic-drunk no, but you can ⏎ if e.is_a?(Errno::Something) ⏎ do x
<FromGitter> <bararchy> etc..
alex`` has joined #crystal-lang
<FromGitter> <watzon> Looks like that could be handled better
<FromGitter> <watzon> There are a few things in the standard library that need to be abstracted a bit still. OpenSSL is one of them.
<FromGitter> <bararchy> yeha , I guess I'll just wait for @j8r Issue to be resolved
<FromGitter> <didactic-drunk> > @didactic-drunk no, but you can ⏎ > if e.is_a?(Errno::Something) ⏎ > do x ⏎ ⏎ No you can't because it's not a subclass. https://carc.in/#/r/7lkw [https://gitter.im/crystal-lang/crystal?at=5d83574aa38dae3a637cc614]
<FromGitter> <watzon> Looks like we could actually get Onigmo in Crystal instead of PCRE https://github.com/crystal-lang/crystal/issues/8199#issuecomment-533056418
<FromGitter> <stronny> afair `e.value == Errno::ENOINT`
<FromGitter> <bararchy> That would be nice
<FromGitter> <stronny> would definitely by much more nice to be able to rescue separately
<FromGitter> <bararchy> @stronny it is, but it's an Int32, which indeed eq to the constant, but, there is no way to resolve `Errno::ENOINT` from `e.value` unless you create an enum
<FromGitter> <watzon> No kidding. It would make copying regex from Ruby libs a lot easier
<FromGitter> <watzon> @stronny agreed, needs some refactoring
<FromGitter> <stronny> I don'y understand the problem. Yes, you can't resolve a constant by its value, but do you really need to?
<FromGitter> <stronny> Instead of an Errno enum why not subclass `Errno::ENOENT < Errno` and then `rescue x : Errno::ENOENT`?
<FromGitter> <j8r> yep they could be each individual classes
<FromGitter> <j8r> instead of constants
<FromGitter> <bararchy> because then I'll need to do 50~ different rescues XD
<FromGitter> <bararchy> I just want to get the string of the actual "class" of error
<FromGitter> <bararchy> I don't have anything else to do with it
<FromGitter> <stronny> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5d835c0d8521b34d91525a18]
<FromGitter> <j8r> @bararchy my carc.in doesn't do the job?
<FromGitter> <j8r> the missing constants are annoying, this wasn't just' caught because they aren't used at all
<FromGitter> <bararchy> @j8r It did help :) thanks
absolutejam has quit [Ping timeout: 258 seconds]
absolutejam has joined #crystal-lang
Raimondi has quit [Read error: Connection reset by peer]
Raimondi has joined #crystal-lang
livcd has quit [Ping timeout: 245 seconds]
<FromGitter> <asterite> we didn't do errno subclasses because it was slow: https://github.com/crystal-lang/crystal/pull/445
<FromGitter> <stronny> maybe at least suger it up a bit to be able to do `if error.enoent?` ?
absolutejam has quit [Ping timeout: 268 seconds]
<FromGitter> <asterite> I think Errno#errno should be an enum, then you could do `if error.errno.enoent?`
<FromGitter> <didactic-drunk> @stronny See #1124 referenced from #445. @asterite already said he may add C# like exception filters which seems like it would fix most of the rescue issues.
<DeBot> https://github.com/crystal-lang/crystal/issues/1124 (add exception filters) | https://github.com/crystal-lang/crystal/pull/445 (Added specific Errno exceptions (Errno::ENOENT, ...))
<FromGitter> <stronny> idk if I'm onboard
<FromGitter> <didactic-drunk> ?
<FromGitter> <stronny> not sure if that's a good idea
<FromGitter> <mwlang> anybody else get withdrawal symptoms when pulled back to Ruby work and missing the Crystal experience? :-)
<FromGitter> <wontruefree> If anyone is interested in hearing about NLP we are making out meetup remote friendly https://twitter.com/chicago_crystal/status/1174709640963284994?s=20
<FromGitter> <naqvis> 👏
<FromGitter> <wontruefree> I am super excited to be kicking the meetup off again
<FromGitter> <kinxer> Will it be recorded?
ht_ has joined #crystal-lang
<FromGitter> <naqvis> wish, it will be recorded, as time doesn't suit to global audience 😏
absolutejam has joined #crystal-lang
absolutejam has quit [Ping timeout: 246 seconds]
<FromGitter> <rishavs> anyone has used online IDEs/environments with Crystal? Looking to try one as I am getting tired of switching between my devices
<FromGitter> <Daniel-Worrall> Sublime,vim or bad
<FromGitter> <Daniel-Worrall> Vsc*
<FromGitter> <Daniel-Worrall> That's an odd autocorrect
<FromGitter> <tenebrousedge> I liked Cloud9 but never used it with Crystal
hightower3 has quit [Read error: Connection reset by peer]
dannyAAM has quit [Quit: znc.saru.moe : ZNC 1.6.2 - http://znc.in]
dannyAAM has joined #crystal-lang
rohitpaulk has joined #crystal-lang
absolutejam has joined #crystal-lang
rohitpaulk has quit [Remote host closed the connection]
absolutejam has quit [Quit: WeeChat 2.5]
Human_G33k has joined #crystal-lang
HumanG33k has quit [Ping timeout: 245 seconds]
<sorcus> https://gist.github.com/MrSorcus/5b862c7ac05bc34f9feed03f5a89fa3c - how to fix this? Fibers about 1000, ulimit -a for open files is 20000.
ht_ has quit [Quit: ht_]
<FromGitter> <c-cube> for subprocesses, there seems to be a pool of threads doing the IOs, right? ⏎ I'm running a bunch of fibers, each of which does `Process.run`, but it doesn't kill my load
<FromGitter> <Blacksmoke16> it uses fibers internally
<FromGitter> <Blacksmoke16> and `#run` waits for it to finish
<FromGitter> <c-cube> yeah but I mean, it doesn't try to start 100 processes in //
<FromGitter> <Blacksmoke16> right, they would go sequentially no?
<FromGitter> <Blacksmoke16> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5d83ecd3c77f285fb1a9cc4b]
<FromGitter> <c-cube> I run each in a separate fiber
<FromGitter> <Blacksmoke16> they already run in fibers tho?
<FromGitter> <Blacksmoke16> my understanding is your spawning a fiber with a process.run, which spawns another fiber and blocks until the process is done
<FromGitter> <Blacksmoke16> so essentially only doing 1 process at a time
<FromGitter> <c-cube> but I'm doing that in a lot of different fibers
<FromGitter> <c-cube> something like `Dir.glob("*") { |file| spawn { … } }` where each fiber runs a process on the file, basically
<sorcus> Hmmmm... Maybe i should logout and login again, because no errors if i run binary as root.
gangstacat has quit [Ping timeout: 246 seconds]
alex`` has quit [Ping timeout: 276 seconds]
gangstacat has joined #crystal-lang
Human_G33k has quit [Remote host closed the connection]
Human_G33k has joined #crystal-lang
Human_G33k has quit [Remote host closed the connection]
Human_G33k has joined #crystal-lang
ishahnaz has joined #crystal-lang
ishahnaz has quit [Client Quit]