Skip to content

Instantly share code, notes, and snippets.

@Srgr0
Last active March 20, 2023 18:43
Show Gist options
  • Save Srgr0/4f91afed97866673771f5f44efcbbd1e to your computer and use it in GitHub Desktop.
Save Srgr0/4f91afed97866673771f5f44efcbbd1e to your computer and use it in GitHub Desktop.
Building-John-the-Ripper-on-mac-m1

Building John the Ripper on M1 Mac

Download John-the-Ripper

curl https://www.openwall.com/john/k/john-1.9.0-jumbo-1.tar.xz -O        
tar -zxvf john-1.9.0-jumbo-1.tar.xz
cd ./john-1.9.0-jumbo-1/src

Patch for M1

nano ./pseudo_intrinsics.h

Replace these

#define vroti_epi32(x, i)       (i > 0 ? (vtype)vsliq_n_u32(vshrq_n_u32((x).v32, 32 - (i)), (x).v32, i) : \
                                         (vtype)vsriq_n_u32(vshlq_n_u32((x).v32, 32 + (i)), (x).v32, -(i)))
#define vroti_epi64(x, i)       (i > 0 ? (vtype)vsliq_n_u64(vshrq_n_u64((x).v64, 64 - (i)), (x).v64, i) : \
                                         (vtype)vsriq_n_u64(vshlq_n_u64((x).v64, 64 + (i)), (x).v64, -(i)))

with these

#define vroti_epi32(x, i)       (i > 0 ? (vtype)vsliq_n_u32(vshrq_n_u32((x).v32, 32 - ((i) & 31)), (x).v32, (i) & 31) : \
                                 (vtype)vsriq_n_u32(vshlq_n_u32((x).v32, (32 + (i)) & 31), (x).v32, (-(i)) & 31))
#define vroti_epi64(x, i)       (i > 0 ? (vtype)vsliq_n_u64(vshrq_n_u64((x).v64, 64 - ((i) & 63)), (x).v64, (i) & 63) : \
                                 (vtype)vsriq_n_u64(vshlq_n_u64((x).v64, (64 + (i)) & 63), (x).v64, (-(i)) & 63))

Configure & Make

./configure CC=gcc LDFLAGS="-L/opt/homebrew/opt/openssl@1.1/lib"  CPPFLAGS="-I/opt/homebrew/opt/openssl@1.1/include" && make -s clean && make -sj4

tips;

> configure: error: in `~/Downloads/john-1.9.0-jumbo-1/src':
> configure: error: C compiler cannot create executables
more config.log
> gcc-10: command not found
brew install gcc

Test

cd ../run
./john --test

Links

https://qiita.com/tony-stark/items/2a432c75ec36be9ef53e

https://gist.github.com/reggi/2faadedd925789a3d25196f2a036ecc6

openwall/john#4585

https://mimaunes.hatenablog.com/entry/20160111/1452482635

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment