diff --git a/LICENSE b/LICENSE
new file mode 100644
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,22 @@
+The MIT License (MIT)
+
+Copyright (c) <year> <copyright holders>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+
diff --git a/PasswordGenerator.cabal b/PasswordGenerator.cabal
new file mode 100644
--- /dev/null
+++ b/PasswordGenerator.cabal
@@ -0,0 +1,28 @@
+name:                PasswordGenerator
+version:             0.1.0.0
+synopsis:            Simple library for generating passwords
+description:         Simple library for generating passwords.
+-- description:
+homepage:            https://github.com/VictorDenisov/PasswordGenerator
+license:             MIT
+license-file:        LICENSE
+author:              Victor Denisov
+maintainer:          denisovenator@gmail.com
+
+-- copyright:
+category:            Cryptography
+build-type:          Simple
+
+-- extra-source-files:
+cabal-version:       >=1.10
+
+library
+  exposed-modules:     Crypto.PasswordGenerator
+  build-depends:       base >=4.5 && < 4.7
+                     , QuickCheck == 2.6.*
+  hs-source-dirs:      src
+  default-language:    Haskell2010
+
+source-repository head
+  type:                git
+  location:            https://github.com/VictorDenisov/PasswordGenerator
diff --git a/Setup.hs b/Setup.hs
new file mode 100644
--- /dev/null
+++ b/Setup.hs
@@ -0,0 +1,2 @@
+import Distribution.Simple
+main = defaultMain
diff --git a/src/Crypto/PasswordGenerator.hs b/src/Crypto/PasswordGenerator.hs
new file mode 100644
--- /dev/null
+++ b/src/Crypto/PasswordGenerator.hs
@@ -0,0 +1,52 @@
+module Crypto.PasswordGenerator
+( Flag(..)
+, genPassword
+) where
+
+import Control.Applicative
+import Data.List
+import Test.QuickCheck.Gen
+
+data Flag = Digits
+          | Uppers
+          | Lowers
+          | Symbols
+          | Ambiguous
+          | Vowels
+            deriving (Eq)
+
+-- | Generate a password of required length with provided flags.
+genPassword :: [Flag] -> Int -> IO String
+genPassword flags len = try
+  where
+    try = do
+      l <- sample' $ vectorOf len $ oneof gens
+      let v = find good l
+      case v of
+        Just x -> return x
+        Nothing -> try
+    gens = map toGen flags
+    good = foldl' (\a v -> (liftA2 (&&)) a $ toChecker v) alwaysTrue flags
+
+digitList    = sort "0123456789"
+upperList    = sort "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+lowerList    = sort "abcdefghijklmnopqrstuvwxyz"
+symbolList   = sort "!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~"
+ambiguouList = sort "B8G6I1l0OQDS5Z2"
+vowelList    = sort "01aeiouyAEIOUY"
+
+toGen Digits    = elements digitList
+toGen Uppers    = elements upperList
+toGen Lowers    = elements lowerList
+toGen Symbols   = elements symbolList
+toGen Ambiguous = elements ambiguouList
+toGen Vowels    = elements vowelList
+
+toChecker Digits  s = s `containsAnyOf` digitList
+toChecker Uppers  s = s `containsAnyOf` upperList
+toChecker Symbols s = s `containsAnyOf` symbolList
+toChecker _       s = True
+
+alwaysTrue s = True
+
+s `containsAnyOf` l = not $ null $ intersect l s
