-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Hashids generates short, unique, non-sequential ids from numbers. -- -- This is a Haskell port of the Hashids library. It is typically used to -- encode numbers to a format suitable to appear in visible places like -- urls. It converts numbers like 347 into strings like yr8, or a list of -- numbers like [27, 986] into 3kTMd. You can also decode those ids back. -- This is useful in bundling several parameters into one. @package hashids @version 1.0.2.4 -- | This is a Haskell port of Ivan Akimov's Hashids library. This is -- not a cryptographic hashing algorithm. Hashids is typically -- used to encode numbers to a format suitable to appear in places like -- URLs. -- -- See the official Hashids home page: http://hashids.org -- -- Hashids is a small open-source library that generates short, unique, -- non-sequential ids from numbers. It converts numbers like 347 into -- strings like yr8, or a list of numbers like [27, 986] into -- 3kTMd. You can also decode those ids back. This is useful in -- bundling several parameters into one or simply using them as short -- UIDs. module Web.Hashids -- | Opaque data type with various internals required for encoding and -- decoding. data HashidsContext -- | Hashids version number. version :: String -- | Create a context object using the given salt, a minimum hash length, -- and a custom alphabet. If you only need to supply the salt, or the -- first two arguments, use hashidsSimple or hashidsMinimum -- instead. -- -- Changing the alphabet is useful if you want to make your hashes -- unique, i.e., create hashes different from those generated by other -- applications relying on the same algorithm. createHashidsContext :: ByteString -> Int -> String -> HashidsContext -- | Create a context object using the default alphabet and the provided -- salt, without any minimum required length. hashidsSimple :: ByteString -> HashidsContext -- | Create a context object using the default alphabet and the provided -- salt. The generated hashes will have a minimum length as specified by -- the second argument. hashidsMinimum :: ByteString -> Int -> HashidsContext -- | Encode a hexadecimal number. -- -- Example use: -- --
--   encodeHex context "ff83"
--   
encodeHex :: HashidsContext -> String -> ByteString -- | Decode a hash generated with encodeHex. -- -- Example use: -- --
--   decodeHex context "yzgwD"
--   
decodeHex :: HashidsContext -> ByteString -> String -- | Encode a single number. -- -- Example use: -- --
--   let context = hashidsSimple "this is my salt"
--       hash = encode context 5        -- == "rD"
--   
encode :: HashidsContext -> Int -> ByteString -- | Encode a list of numbers. -- -- Example use: -- --
--   let context = hashidsSimple "this is my salt"
--       hash = encodeList context [2, 3, 5, 7, 11]          -- == "EOurh6cbTD"
--   
encodeList :: HashidsContext -> [Int] -> ByteString -- | Decode a hash. -- -- Example use: -- --
--   let context = hashidsSimple "this is my salt"
--       hash = decode context "rD"        -- == [5]
--   
decode :: HashidsContext -> ByteString -> [Int] -- | Encode a number using the provided salt. -- -- This convenience function creates a context with the default alphabet. -- If the same context is used repeatedly, use encode with one of -- the constructors instead. encodeUsingSalt :: ByteString -> Int -> ByteString -- | Encode a list of numbers using the provided salt. -- -- This function wrapper creates a context with the default alphabet. If -- the same context is used repeatedly, use encodeList with one of -- the constructors instead. encodeListUsingSalt :: ByteString -> [Int] -> ByteString -- | Decode a hash using the provided salt. -- -- This convenience function creates a context with the default alphabet. -- If the same context is used repeatedly, use decode with one of -- the constructors instead. decodeUsingSalt :: ByteString -> ByteString -> [Int] -- | Shortcut for encodeHex. encodeHexUsingSalt :: ByteString -> String -> ByteString -- | Shortcut for decodeHex. decodeHexUsingSalt :: ByteString -> ByteString -> String