Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

CI Go Report CardView ChangelogDownload Binary Releases

cshatag is a tool to detect silent data corruption. It is meant to run periodically and stores the SHA256 of each file as an extended attribute. The project started as a minimal and fast reimplementation of shatag, written in Python by Maxime Augier.

See the Man Page further down this page for details.

Similar Tools

Checksums stored in extended attributes for each file

Checksums stored in single central database

Checksums stored in one database per directory

Compile Yourself

$ git clone
$ cd cshatag
$ make

Man Page

CSHATAG(1)                       User Manuals                       CSHATAG(1)

       cshatag - compiled shatag

       cshatag [OPTIONS] FILE [FILE...]

       cshatag is a minimal and fast re-implementation of shatag
       (  ,  written  in  Python  by Maxime
       Augier )
       in a compiled language (since v2.0: Go, earlier versions: C).

       cshatag is a tool to detect silent data corruption. It writes the mtime
       and  the sha256 checksum of a file into the file's extended attributes.
       The filesystem needs to be mounted with user_xattr enabled for this  to
       work.   When  run  again,  it compares stored mtime and checksum. If it
       finds that the mtime is unchanged but  the  checksum  has  changed,  it
       warns  on  stderr.   In  any case, the status of the file is printed to
       stdout and the stored checksum is updated.

       File statuses that appear on stdout are:
            <new>         file is missing both attributes
            <outdated>    both mtime and checksum have changed
            <ok>          both checksum and mtime stayed the same
            <timechange>  only mtime has changed, checksum stayed the same
            <corrupt>     mtime stayed the same but checksum changed

       cshatag aims to be format-compatible with shatag and uses the same  ex‐
       tended attributes (see the COMPATIBILITY section).

       cshatag was written in C in 2012 and has been rewritten in Go in 2019.

       -dry-run    don't make any changes
       -recursive  recursively process the contents of directories
       -remove     remove cshatag's xattrs from FILE
       -q          quiet mode - don't report <ok> files
       -qq         quiet2 mode - only report <corrupt> files and errors

       Check  all regular files in the file tree below the current working di‐
       # cshatag -qq -recursive .
       Errors like corrupt files will be printed to stderr.  Run without "-qq"
       to see progress output.

       To remove the extended attributes from all files:
       # cshatag -recursive -remove .

       0 Success
       1 Wrong number of arguments
       2 One or more files could not be opened
       3 One or more files is not a regular file
       4 Extended attributes could not be written to one or more files
       5 At least one file was found to be corrupt
       6 More than one type of error occurred

       cshatag  writes  the  user.shatag.ts field with full integer nanosecond
       precision, while python uses a double for the whole mtime and loses the
       last few digits.

       Jakob   Unterwurzacher   <>,‐

       Copyright 2012 Jakob Unterwurzacher. MIT License.

       shatag(1), sha256sum(1), getfattr(1), setfattr(1)

Linux                              MAY 2012                         CSHATAG(1)


Short changelog - for all the details look at the git log.

v2.1.0, 2022-10-22

  • Add -dry-run #22
  • This version is called v2.1.0 as opposed to v2.1 to conform to go.mod versioning rules (three-digit semver).

v2.0, 2020-11-15

  • Rewrite cshatag in Go
  • add MacOS support
  • Add -remove flag
  • Add -q and -qq flags
  • Accept multiple files per invocation to improve performance
  • Work around problems on MacOS SMB mounts (#11)

v1.1, 2019-06-09

  • Add test suite (make test) (commit)
  • Add Travis CI
  • Drop useless trailing null byte from user.shatag.sha256

v1.0, 2019-01-02

  • Add make format target


  • Fix missing null termination in ts buffer that could lead to false positives (commit)


  • Respect PREFIX for make install (commit)


  • Check for malloc returning NULL (commit)


  • C source code & man page published on Github (commit)


Detect silent data corruption under Linux using sha256 stored in extended attributes







No packages published