executable-hash: Provides the SHA1 hash of the program executable

[ library, mit, program, system ] [ Propose Tags ]

See README.md


[Skip to Readme]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1.1.1, 0.2.0.0, 0.2.0.1, 0.2.0.2, 0.2.0.3, 0.2.0.4
Change log ChangeLog.md
Dependencies base (>=4.0 && <5.0), bytestring, cryptohash, directory, executable-hash, executable-path (>=0.0.3 && <0.1), file-embed (>=0.0.8 && <0.1) [details]
License MIT
Copyright 2015 FP Complete
Author Michael Sloan
Maintainer FP Complete <sloan@fpcomplete.com>
Category System
Home page http://github.com/fpco/executable-hash
Bug tracker http://github.com/fpco/executable-hash/issues
Source repo head: git clone git://github.com/fpco/executable-hash
Uploaded by MichaelSloan at 2015-03-16T20:17:55Z
Distributions LTSHaskell:0.2.0.4, NixOS:0.2.0.4, Stackage:0.2.0.4
Reverse Dependencies 1 direct, 0 indirect [details]
Executables inject-executable-hash
Downloads 4976 total (29 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs uploaded by user [build log]
All reported builds failed as of 2015-03-16 [all 1 reports]

Readme for executable-hash-0.1.1.1

[back to package description]

executable-hash

Provides the SHA1 hash of the executable. This hash can either be injected into the executable as a step after compilation, or calculated at runtime.

Usage

The main function expected to be used by the user is System.Executable.Hash.executableHash. This function yields a SHA1 hash determined by the contents of the executable. However, note that this may not be the actual SHA1 of the executable, since the hash can be injected into the executable (which changes its "actual" hash).

Installing this package will also install the inject-executable-hash executable. Running this program on a binary, like inject-executable-hash <binary-name> will replace a dummy ByteString (via the file-embed package) in the binary with its hash.

Alternatively, you can put this in a Setup.hs file, and set build-type: Custom in your .cabal:

import Distribution.Simple
import System.Executable.Hash.Internal (maybeInjectExecutableHash)

main :: IO ()
main = defaultMainWithHooks $ simpleUserHooks
    { postBuild = \_ _ _ _ ->
        maybeInjectExecutableHash "dist/build/path-to/your-executable"
    }

(Note: you'll need to change the executable path)