crackNum 3.0 → 3.1
raw patch · 3 files changed
+81/−55 lines, 3 files
Files
- CHANGES.md +5/−1
- README.md +75/−53
- crackNum.cabal +1/−1
CHANGES.md view
@@ -1,7 +1,11 @@ * Hackage: <http://hackage.haskell.org/package/crackNum> * GitHub: <http://github.com/LeventErkok/crackNum/> -* Latest Hackage released version: 3.0, 2021-03-29+* Latest Hackage released version: 3.1, 2021-03-29++### Version 3.1, 2021-03-29+ + * Fix readme ### Version 3.0, 2021-03-29
README.md view
@@ -1,45 +1,8 @@ ## Decode/Encode Integers, Words, and IEE754 Floats -[](http://hackage.haskell.org/package/crackNum)-[](http://travis-ci.org/LeventErkok/crackNum)--```-Usage: crackNum value OR binary/hex-pattern- -i N Signed integer of N-bits- -w N Unsigned integer of N-bits- -f fp Floating point format fp- -r rm Rounding mode to use. If not given, Nearest-ties-to-Even.- -h, -? --help print help, with examples- -v --version print version info--Examples:- Encoding:- crackNum -i4 -- -2 -- encode as 4-bit signed integer- crackNum -w4 2 -- encode as 4-bit unsigned integer- crackNum -f3+4 2.5 -- encode as float with 3 bits exponent, 4 bits significand- crackNum -f3+4 2.5 -rRTZ -- encode as above, but use RTZ rounding mode.- crackNum -fbp 2.5 -- encode as a brain-precision float- crackNum -fdp 2.5 -- encode as a double-precision float-- Decoding:- crackNum -i4 0b0110 -- decode as 4-bit signed integer, from binary- crackNum -w4 0xE -- decode as 4-bit unsigned integer, from hex- crackNum -f3+4 0b0111001 -- decode as float with 3 bits exponent, 4 bits significand- crackNum -fbp 0x000F -- decode as a brain-precision float- crackNum -fdp 0x8000000000000000 -- decode as a double-precision float-- Notes:- - For encoding:- - Use -- to separate your argument if it's a negative number.- - For floats: You can pass in NaN, Inf, -0, -Inf etc as the argument, along with a decimal float.- - For decoding:- - Use hexadecimal (0x) or binary (0b) as input. Input must have one of these prefixes.- - You can use _,- or space as a digit to improve readability for the pattern to be decoded-```+On Hackage: http://hackage.haskell.org/package/crackNum -VIM users: You can use the https://github.com/LeventErkok/crackNum/blob/master/crackNum.vim file to-use CrackNum directly from VIM. Simply locate your cursor on the text to crack, and use the-command `:CrackNum options`.+[](http://travis-ci.org/LeventErkok/crackNum) ### Example: Encode a decimal numer as a single-precision IEEE754 number ```@@ -62,26 +25,46 @@ Rounding mode: RNE: Round nearest ties to even. ``` -### Example: Decode a double-precision IEEE754 number from memory-layout+### Example: Decode a single-precision IEEE754 number float from memory-layout ```-$ crackNum -fdp 0xfc00 abc1 7F80 0001+$ crackNum -fsp 0xfc00 abc1 Satisfiable. Model:- DECODED = -2.0307920360962302e289 :: Double- 6 5 4 3 2 1 0- 3 21098765432 1098765432109876543210987654321098765432109876543210- S ----E11---- ------------------------S52-------------------------- Binary layout: 1 11111000000 0000101010111100000101111111100000000000000000000001- Hex layout: FC00 ABC1 7F80 0001- Precision: Double+ DECODED = -2.6723903e36 :: Float+ 3 2 1 0+ 1 09876543 21098765432109876543210+ S ---E8--- ----------S23----------+ Binary layout: 1 11111000 00000001010101111000001+ Hex layout: FC00 ABC1+ Precision: Single Sign: Negative- Exponent: 961 (Stored: 1984, Bias: 1023)+ Exponent: 121 (Stored: 248, Bias: 127) Classification: FP_NORMAL- Binary: -0b1.0000101010111100000101111111100000000000000000000001p+961- Octal: -0o2.05274057740000001p+960- Decimal: -2.0307920360962302e289- Hex: -0x2.15782FF000002p+960+ Binary: -0b1.00000001010101111000001p+121+ Octal: -0o2.00527404p+120+ Decimal: -2.6723903e36+ Hex: -0x2.02AF04p+120+$ crackNum -fdp 0xfc00 abc1 7F80 0001 ``` +### Example: Decode a custom (2+3) IEEE754 float from memory-layout+```+$ crackNum -f2+3 0b10011+Satisfiable. Model:+ DECODED = -0.75 :: FloatingPoint 2 3+ 4 32 10+ S E2 S2+ Binary layout: 1 00 11+ Hex layout: 13+ Precision: 2 exponent bits, 2 significand bits+ Sign: Negative+ Exponent: 0 (Subnormal, with fixed exponent value. Stored: 0, Bias: 1)+ Classification: FP_SUBNORMAL+ Binary: -0b1.1p-1+ Octal: -0o6p-3+ Decimal: -0.75+ Hex: -0xcp-4+```+ ### Example: Encode an integer as a 7-bit signed word ``` $ crackNum -i7 12@@ -97,3 +80,42 @@ Decimal: 12 Hex: 0xc ```++### Usage info+```+Usage: crackNum value OR binary/hex-pattern+ -i N Signed integer of N-bits+ -w N Unsigned integer of N-bits+ -f fp Floating point format fp+ -r rm Rounding mode to use. If not given, Nearest-ties-to-Even.+ -h, -? --help print help, with examples+ -v --version print version info++Examples:+ Encoding:+ crackNum -i4 -- -2 -- encode as 4-bit signed integer+ crackNum -w4 2 -- encode as 4-bit unsigned integer+ crackNum -f3+4 2.5 -- encode as float with 3 bits exponent, 4 bits significand+ crackNum -f3+4 2.5 -rRTZ -- encode as above, but use RTZ rounding mode.+ crackNum -fbp 2.5 -- encode as a brain-precision float+ crackNum -fdp 2.5 -- encode as a double-precision float++ Decoding:+ crackNum -i4 0b0110 -- decode as 4-bit signed integer, from binary+ crackNum -w4 0xE -- decode as 4-bit unsigned integer, from hex+ crackNum -f3+4 0b0111001 -- decode as float with 3 bits exponent, 4 bits significand+ crackNum -fbp 0x000F -- decode as a brain-precision float+ crackNum -fdp 0x8000000000000000 -- decode as a double-precision float++ Notes:+ - For encoding:+ - Use -- to separate your argument if it's a negative number.+ - For floats: You can pass in NaN, Inf, -0, -Inf etc as the argument, along with a decimal float.+ - For decoding:+ - Use hexadecimal (0x) or binary (0b) as input. Input must have one of these prefixes.+ - You can use _,- or space as a digit to improve readability for the pattern to be decoded+```++VIM users: You can use the https://github.com/LeventErkok/crackNum/blob/master/crackNum.vim file to+use CrackNum directly from VIM. Simply locate your cursor on the text to crack, and use the+command `:CrackNum options`.
crackNum.cabal view
@@ -1,6 +1,6 @@ Cabal-version : 2.2 Name : crackNum-Version : 3.0+Version : 3.1 Synopsis : Crack various integer and floating-point data formats Description : Crack IEEE-754 float formats and arbitrary sized words and integers, showing the layout. .