Getting a password from shell input for use with bcrypt and a database is something others may want to do in the future - can you copy-paste the problem code here for us to look at?
Matt On Saturday, December 23, 2017 at 8:14:48 PM UTC-6, Gabriel Simmer wrote: > > I guess I should update this with the solution; > > As it turns out, the method I was using for getting user input was > returning the user input in some funky way that I couldn't trace/replicate. > I went with randomly generating the password, and that inserts/verifies > just fine. > > On Tuesday, December 5, 2017 at 11:39:38 AM UTC-8, Gabriel Simmer wrote: >> >> Hey Gophers, >> >> I have a bit of a headscratcher for you guys today, hoping someone will >> be able to help me track down where I've gone wrong. I have an SQLite3 >> database with user login info, including username, hashed password w/ >> bcrypt, and so on. I also have a "setup" method that is triggered on the >> first run of the application, which includes creating the database, setting >> an admin password and fetching assets. There's one hitch - the hashed >> password doesn't seem to be either: >> >> - Stored properly >> - Hashed properly >> - Compared properly >> >> I've done some extensive testing and it appears bcrypt *is* hashing the >> password, and I can compare it successfully right after, and before I put >> it into the database. All good. However when I pull the hash from the >> database later (on user login), bcrypt doesn't see the hash and the >> password as equal and errors out. >> >> Here is the GitHub repository's branch >> <https://github.com/gmemstr/pogo/tree/setup>, if you want to fully test >> the application, but the relevant files are setup.go >> <https://github.com/gmemstr/pogo/blob/setup/setup.go#L38-L56> and >> router/router.go >> <https://github.com/gmemstr/pogo/blob/setup/router/router.go#L125-L207>. >> I've left in some debugging checks, and will happily answer any questions I >> haven't clarified. >> > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.