Skip to content

Instantly share code, notes, and snippets.

@michaelgpearce
Last active March 13, 2019 08:13
Show Gist options
  • Save michaelgpearce/d69978840250ad177f61fb0fad830b27 to your computer and use it in GitHub Desktop.
Save michaelgpearce/d69978840250ad177f61fb0fad830b27 to your computer and use it in GitHub Desktop.
Parallel Workforce Caller
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