
Security News
Rspack Introduces Rslint, a TypeScript-First Linter Written in Go
Rspack launches Rslint, a fast TypeScript-first linter built on typescript-go, joining in on the trend of toolchains creating their own linters.
Ruby implementation of the format-preserving IPCrypt encryption algorithm for IPv4 addresses.
IPCrypt is a format-preserving cipher for IPv4 addresses - that is, a cipher that accepts an IPv4 address for encryption, and generates a new decryptable IPv4 address.
The cipher was developed by Jean-Philippe Aumasson, initially in the form of a python implementation which is the reference for this Ruby implementation.
This gem provides:
ipcrypt
) for the encryption/decryption of IPv4 addresses stored in CSV filesIPCrypt::IP
) for the encryption/decryption of IPv4 addresses of the class String
within Ruby applicationsInstall the ipcrypt
gem:
$ gem install ipcrypt
The CLI should be available to use after the gem has been installed:
$ ipcrypt
Commands:
ipcrypt d [CSV] [COLUMN] # Decrypt IPv4 addresses from a CSV file
ipcrypt e [CSV] [COLUMN] # Encrypt IPv4 addresses from a CSV file
Options:
-k, --key=KEY # 16-byte key
gem 'ipcrypt'
$ bundle install
$ cat test.csv
id,firstname,lastname,ip_address,country
1,a,b,127.0.0.1,c
2,d,e,0.0.0.0,f
3,g,h,255.255.255.255,i
4,j,k,192.168.2.1,l
$ ipcrypt e test.csv ip_address -k '16-byte-key-123!' > encrypted.csv
$ cat encrypted.csv
id,firstname,lastname,ip_address,country
1,a,b,94.99.154.180,c
2,d,e,34.112.126.36,f
3,g,h,6.156.93.249,i
4,j,k,41.85.161.64,l
$ ipcrypt d encrypted.csv ip_address -k '16-byte-key-123!'
id,firstname,lastname,ip_address,country
1,a,b,127.0.0.1,c
2,d,e,0.0.0.0,f
3,g,h,255.255.255.255,i
4,j,k,192.168.2.1,l
The IPCrypt::IP
is an interface for instantiating an IPCrypt::Engine
- this class performs the task of encryption and decryption.
A random 16-byte key will be generated and stored as the @default_key
instance variable - this can be retrieved with the #default_key
attribute reader. This default key is used as the encryption key if none is specified as an argument for the #encrypt
instance method.
crypter = IPCrypt::IP['94.175.013.122', '73.155.92.01']
=> #<IPCrypt::Engine:0x00007f87139ae150 @default_key="\xB5\xBA\xE1\xD6\x1C\x9F\xD1#[\x93\xD8\x86\xBC\xFD\xACx", @ips=["94.175.013.122", "73.155.92.01"]>
crypter.ips = crypter.encrypt
=> ["126.189.155.194", "51.239.168.232"]
crypter
=> #<IPCrypt::Engine:0x00007f87139ae150 @default_key="\xB5\xBA\xE1\xD6\x1C\x9F\xD1#[\x93\xD8\x86\xBC\xFD\xACx", @ips=["126.189.155.194", "51.239.168.232"]>
crypter.decrypt crypter.default_key
=> ["94.175.13.122", "73.155.92.1"]
key = 'secret-16-bytes!'
=> "secret-16-bytes!"
crypter = IPCrypt::IP['94.175.013.122', '73.155.92.01']
=> #<IPCrypt::Engine:0x00007fe851049db8 @default_key="\xCC\xE0j\x13s\xB9B+\xEF'\xC8\xFC\xD4\xA5\xFCW", @ips=["94.175.013.122", "73.155.92.01"]>
crypter.ips = crypter.encrypt key
=> ["239.130.3.132", "168.16.121.58"]
crypter
=> #<IPCrypt::Engine:0x00007fb84f1a4230 @default_key="FN\xECa\x92\xA3\x1A\xC3(E\x9E\xF4\xD4\xBC\x8F)", @ips=["239.130.3.132", "168.16.121.58"]>
crypter.decrypt key
=> ["94.175.13.122", "73.155.92.1"]
Bug reports and pull requests are welcome on GitHub at https://github.com/eonu/ipcrypt.
FAQs
Unknown package
We found that ipcrypt demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Rspack launches Rslint, a fast TypeScript-first linter built on typescript-go, joining in on the trend of toolchains creating their own linters.
Security News
Hacker Demonstrates How Easy It Is To Steal Data From Popular Password Managers
Security News
Oxlint’s new preview brings type-aware linting powered by typescript-go, combining advanced TypeScript rules with native-speed performance.