Skip to content

Commit

Permalink
Remove CLI part of CRC to strip dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
laborg committed Nov 27, 2020
1 parent 0633ea1 commit f71ebcc
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 133 deletions.
12 changes: 4 additions & 8 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
name = "CRC"
uuid = "44b605c4-b955-5f2b-9b6d-d2bd01d3d205"
authors = ["Andrew Cooke <andrew@acooke.org>"]
version = "3.1.0"

[deps]
ArgParse = "c7e460c6-2fb9-53a9-8c5b-16f535851c63"
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
version = "4.0.0"

[compat]
ArgParse = "1.1.0"
julia = "1"

[extras]
Libz = "2ec943e9-cfe8-584d-b93d-64dcb6d567b7"
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["Test", "Libz"]
test = ["Test", "Libz", "Random", "Printf"]
58 changes: 3 additions & 55 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
# CRC

This is a [Julia](http://julialang.org/) module for calculating Cyclic
Redundancy Checksums (CRCs). It also contains a [command
line](#from-the-command-line) tool for calculating the CRC of files.
Redundancy Checksums (CRCs).

* All the algorithms in the [RevEng
Catalogue](http://reveng.sourceforge.net/crc-catalogue) are supported.
Expand Down Expand Up @@ -87,39 +86,6 @@ julia> CRC_7
CRC.Spec{UInt8}(7, 0x09, 0x00, false, false, 0x00, 0x75)
```

## From the Command Line

The `main(ARGS)` function is a simple utility for calculating the
checksum of files:

```
andrew@laptop:~/project/CRC> julia -e "using CRC; main(ARGS)" -- -h
usage: <PROGRAM> [-l] [-d] [-c CRC] [-a] [-h] [files...]
Calculate the CRC for the given files
positional arguments:
files the files to read (- for stdin)
optional arguments:
-l, --list list available CRC algorithms
-d, --decimal show checksums as decimal values (default is hex)
-c, --crc CRC name the CRC to use (default: CRC_32)
-a, --append combine the data from all files
-h, --help show this help message and exit
andrew@laptop:~/project/CRC> alias crc='julia -e "using CRC; main(ARGS)" -- '
andrew@laptop:~/project/CRC> crc -l | grep "CRC_32"
CRC_32_XFER width=32 poly=0x000000af init=0x00000000 refin=false refout=false xorout=0x00000000 check=0xbd0be338
CRC_32_POSIX width=32 poly=0x04c11db7 init=0x00000000 refin=false refout=false xorout=0xffffffff check=0x765e7680
...
andrew@laptop:~/project/CRC> echo -n "123456789" > /tmp/crc.txt
andrew@laptop:~/project/CRC> crc /tmp/crc.txt
0xcbf43926 /tmp/crc.txt
```

Note that the result matches the `check` value for the algorithm.

## Installation

Julia can be downloaded [here](http://julialang.org/downloads/). Once
Expand All @@ -129,28 +95,10 @@ Julia is working you can install this package using:
julia> Pkg.add("CRC")
```

Then, to define the `crc` command line utility:

```
alias crc='julia -e "using CRC; main(ARGS)" -- '
```

(in, for example, `.alias`).

## Other CRC Packages

* [CRC32.jl](https://github.com/fhs/CRC32.jl) is a simple implementation of
CRC_32 - it is easier to understand than this code, but slower, and only
supports a single CRC algorithm.

* [libz](https://github.com/dcjones/Zlib.jl) includes (amongst many
other things) a wrapper to a C version of CRC_32 - it is similar in
speed to this package (and wil be faster for short, single uses,
because the lookup table is pre-calculated), but only supports that
single algorithm.

## Versions

* 4.0.0 - 2020-11-27 Remove command line functionality.

* 3.1.0 - 2020-11-07 Update ArgParse dependency and add Project.toml.

* 3.0.0 - 2018-02-28 Update for Julia 1.0
Expand Down
1 change: 0 additions & 1 deletion src/CRC.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,5 @@
module CRC

include("crc_calc.jl")
include("crc_cmdline.jl")

end
69 changes: 0 additions & 69 deletions src/crc_cmdline.jl

This file was deleted.

0 comments on commit f71ebcc

Please sign in to comment.