Created
          February 28, 2016 03:45 
        
      - 
      
- 
        Save kyhau/04a97db88815469beda8 to your computer and use it in GitHub Desktop. 
    Hash a password (text) using bcrypt.hashpw with a random salt
  
        
  
    
      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
    
  
  
    
  | import argparse | |
| import bcrypt | |
| def main(): | |
| """ | |
| simple script to get a hashed password from text | |
| """ | |
| parser = argparse.ArgumentParser() | |
| parser.add_argument('--text', required=True, help='input text') | |
| args = parser.parse_args() | |
| input_text = args.text.strip() | |
| # Hash a password using the OpenBSD bcrypt scheme | |
| print bcrypt.hashpw(input_text, bcrypt.gensalt()) | |
| if __name__ == '__main__': | |
| main() | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment