Last active
March 13, 2019 08:13
-
-
Save michaelgpearce/d69978840250ad177f61fb0fad830b27 to your computer and use it in GitHub Desktop.
Parallel Workforce Caller
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'bcrypt' | |
passwords = ['password 1', 'password 2', 'password 3'] | |
password_hashes = ParallelWorkforce.perform_all( | |
actor_classes: Array.new(passwords.size) { PasswordHashGenerator }, | |
actor_args_array: passwords.map { |password| { password: password } }, | |
) | |
# check that password hashes match | |
passwords.zip(password_hashes).each do |password, password_hash| | |
raise "Password does not match hash" if BCrypt::Password.new(password_hash) != password | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment