Swiftpack.co -  moriturus/Ainu as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
Password Validator & Strength Evaluator influenced by Navajo and written in Swift completely.
.package(url: "https://github.com/moriturus/Ainu.git", from: "6.0.0")


Carthage compatible MIT License

Password Validator & Strength Evaluator influenced by Navajo.
Ainu is completely written in Swift 4.

Ainu is named in honour of the famed non-Japonic Languages speakers in the north of Japan.


  • OSX 10.10+
  • iOS 9.0+
  • watchOS 3.0+
  • tvOS 9.0+


If you want to use Carthage, please use the commitment tagged 5.0.1

Swift Package Manager

Add this lines to your Package.swift.

dependencies: [
        url: "https://github.com/moriturus/Ainu.git",
        from: "6.0.0"


Validating Password

let password = "abc123"

// default validator's rule is `LengthRule(minimum: 8, maximum: 128)`
let validator = Validator()

let result = validator.validate(password)

switch result {

case .OK:
    // do something with the validated password

case .Failure(let failingRules):
    failingRules.forEach { rule in


Available Validation Rules

  • Allowed Characters
  • Required Characters (e.g. lowercase, uppercase, decimal, symbol)
  • Non-Dictionary Word (OSX/iOS only)
  • Minimum / Maximum Length
  • Predicate Match
  • Regular Expression Match
  • Function Evaluation

Evaluating Password Strength

Password strength is evaluated in terms of information entropy.

let password = "password"
let strength = Strength(password: password)

NSLog(strength.description) // prints "Very Weak"


Henrique Sasaki Yuya


Ainu is available under the MIT license. See the LICENSE file for more info.


Stars: 9
Last commit: 1 year ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Release Notes

5 years ago
  • Add a rule uses Strength.

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API