class Pwgen::RandomGenerator

Overview

Generates completely random passwords using secure random number generation.

This generator creates passwords by randomly selecting characters from a pool based on the specified feature flags. It ensures cryptographic security by using Random::Secure.

Defined in:

pwgen/random_generator.cr

Instance Method Summary

Instance methods inherited from class Pwgen::Generator

generate(length : Int32, flags : Feature, remove : String | Nil) : String generate

Instance Method Detail

def generate(length : Int32, flags : Feature, remove : String | Nil) : String #

Generates a random password.

  • length: Length of the password (must be positive)
  • flags: Feature flags (Digits, Uppers, Symbols, Ambiguous, NoVowels)
  • remove: Optional string of characters to exclude

Raises Pwgen::Error if parameters are invalid or if the character pool becomes empty after removals.


[View source]