diff --git a/ChangeLog.md b/ChangeLog.md
--- a/ChangeLog.md
+++ b/ChangeLog.md
@@ -1,5 +1,15 @@
 # Changelog for `password`
 
+## 3.0.2.1
+
+-   Add Cabal flags to control which hashing algorithms are exported. These flags are
+    `argon2`, `bcrypt`, `pbkdf2`, and `scrypt`. Each flag is enabled by default -
+    disabling it will elide the corresponding module from the library. This allows
+    downstream packagers to disable hashing algorithms which aren't supported on
+    certain platforms.
+    Thanks to [@ivanbakel](https://github.com/ivanbakel)
+    [#63](https://github.com/cdepillabout/password/pull/63)
+
 ## 3.0.2.0
 
 -   Add `extractParams` on `PasswordHash`s
diff --git a/password.cabal b/password.cabal
--- a/password.cabal
+++ b/password.cabal
@@ -1,7 +1,7 @@
 cabal-version: 1.12
 
 name:           password
-version:        3.0.2.0
+version:        3.0.2.1
 category:       Data
 synopsis:       Hashing and checking of passwords
 description:
@@ -46,10 +46,30 @@
     README.md
     ChangeLog.md
 
+flag argon2
+  description: Compile with argon2 support?
+  default: True
+  manual: True
+
+flag bcrypt
+  description: Compile with Scrypt support?
+  default: True
+  manual: True
+
+flag pbkdf2
+  description: Compile with PBKDF2 support?
+  default: True
+  manual: True
+
+flag scrypt
+  description: Compile with Scrypt support?
+  default: True
+  manual: True
+
 custom-setup
   setup-depends:
-      base
-    , Cabal
+      base                      <5
+    , Cabal                     <4
     , cabal-doctest  >=1.0.6 && <1.1
 
 source-repository head
@@ -60,23 +80,31 @@
   hs-source-dirs:
       src
   exposed-modules:
-      Data.Password.Argon2
-      Data.Password.Bcrypt
-      Data.Password.PBKDF2
-      Data.Password.Scrypt
       Data.Password.Validate
+  if flag(argon2)
+    exposed-modules:
+        Data.Password.Argon2
+  if flag(bcrypt)
+    exposed-modules:
+        Data.Password.Bcrypt
+  if flag(pbkdf2)
+    exposed-modules:
+        Data.Password.PBKDF2
+  if flag(scrypt)
+    exposed-modules:
+        Data.Password.Scrypt
   other-modules:
       Paths_password
       Data.Password.Internal
   build-depends:
       base        >= 4.9      && < 5
     , base64      >= 0.3      && < 0.5
-    , bytestring  >= 0.10.8.1 && < 0.12
-    , cryptonite  >= 0.15.1
-    , memory      >= 0.14
+    , bytestring  >= 0.9      && < 0.12
+    , cryptonite  >= 0.15.1   && < 0.31
+    , memory                     < 1
     , password-types             < 2
     , template-haskell
-    , text        >= 1.2.2    && < 1.3
+    , text        >= 1.2.2    && < 3
   ghc-options:
       -Wall
   default-language:
@@ -106,23 +134,43 @@
   type:
       exitcode-stdio-1.0
   hs-source-dirs:
+      src
       test/tasty
   main-is:
       Spec.hs
   other-modules:
-      Argon2
-    , Bcrypt
+      Data.Password.Internal
+    -- We're also putting all the modules from
+    -- the library in these 'other-modules' so
+    -- we don't get warnings.
+    -- Therefore we also don't need to depend
+    -- on the 'password' package in 'build-depends'.
+    , Data.Password.Validate
     , Internal
-    , PBKDF2
-    , Scrypt
     , TestPolicy
     , Validate
     , Paths_password
+  if flag(argon2)
+    other-modules:
+      Argon2
+      Data.Password.Argon2
+  if flag(bcrypt)
+    other-modules:
+      Bcrypt
+      Data.Password.Bcrypt
+  if flag(pbkdf2)
+    other-modules:
+      PBKDF2
+      Data.Password.PBKDF2
+  if flag(scrypt)
+    other-modules:
+      Scrypt
+      Data.Password.Scrypt
   ghc-options:
       -threaded -O2 -rtsopts -with-rtsopts=-N
   build-depends:
       base >=4.9 && <5
-    , password
+    , base64
     , password-types
     , bytestring
     , cryptonite
@@ -132,6 +180,19 @@
     , tasty
     , tasty-hunit
     , tasty-quickcheck
+    , template-haskell
     , text
   default-language:
       Haskell2010
+  if flag(argon2)
+    cpp-options:
+      -DCABAL_FLAG_argon2
+  if flag(bcrypt)
+    cpp-options:
+      -DCABAL_FLAG_bcrypt
+  if flag(pbkdf2)
+    cpp-options:
+      -DCABAL_FLAG_pbkdf2
+  if flag(scrypt)
+    cpp-options:
+      -DCABAL_FLAG_scrypt
diff --git a/test/tasty/Internal.hs b/test/tasty/Internal.hs
--- a/test/tasty/Internal.hs
+++ b/test/tasty/Internal.hs
@@ -7,8 +7,8 @@
 import Test.Tasty.QuickCheck
 import Test.QuickCheck.Instances.Text ()
 
-import Data.Password.Types (mkPassword, Password, PasswordHash)
-import Data.Password.Bcrypt (PasswordCheck(..), Salt(..))
+import Data.Password.Types (mkPassword, Password, PasswordHash, Salt(..))
+import Data.Password.Internal (PasswordCheck(..))
 
 
 testCorrectPassword :: (Eq params, Show params)
diff --git a/test/tasty/Spec.hs b/test/tasty/Spec.hs
--- a/test/tasty/Spec.hs
+++ b/test/tasty/Spec.hs
@@ -1,13 +1,23 @@
+{-# LANGUAGE CPP #-}
+
 import Test.Tasty
 import Test.Tasty.QuickCheck
 import Test.Tasty.Runners (NumThreads(..))
 
 import Data.Password.Types
 
+#ifdef CABAL_FLAG_argon2
 import Argon2 (testArgon2)
+#endif
+#ifdef CABAL_FLAG_bcrypt
 import Bcrypt (testBcrypt)
+#endif
+#ifdef CABAL_FLAG_pbkdf2
 import PBKDF2 (testPBKDF2)
+#endif
+#ifdef CABAL_FLAG_scrypt
 import Scrypt (testScrypt)
+#endif
 import Validate (testValidate)
 
 main :: IO ()
@@ -15,9 +25,17 @@
   testGroup "Password"
     [ testProperty "Password" $ \pass ->
         unsafeShowPassword (mkPassword pass) === pass
+#ifdef CABAL_FLAG_argon2
     , testArgon2
+#endif
+#ifdef CABAL_FLAG_bcrypt
     , testBcrypt
+#endif
+#ifdef CABAL_FLAG_pbkdf2
     , testPBKDF2
+#endif
+#ifdef CABAL_FLAG_scrypt
     , testScrypt
+#endif
     , testValidate
     ]
