From 05f5e296c1a2739189d4d1353e04abd73b3c36c0 Mon Sep 17 00:00:00 2001 From: KOSASIH Date: Fri, 20 Sep 2024 16:40:16 +0700 Subject: [PATCH] Create password_hasher.rb --- global_business/business/lib/password_hasher.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 global_business/business/lib/password_hasher.rb diff --git a/global_business/business/lib/password_hasher.rb b/global_business/business/lib/password_hasher.rb new file mode 100644 index 000000000..489f1d520 --- /dev/null +++ b/global_business/business/lib/password_hasher.rb @@ -0,0 +1,11 @@ +require 'bcrypt' + +class PasswordHasher + def self.hash_password(password) + BCrypt::Password.create(password) + end + + def self.verify_password(password, hashed_password) + BCrypt::Password.new(hashed_password) == password + end +end