Archive for February, 2019

Generating vanity .onion domain names using Amazon AWS GPUs

Saturday, February 16th, 2019

First, here’s a good guide on using Scallion to generate .onion keys using a GPU. Start with that if you’ve got access to the actual hardware. If you own the hardware, presumably you have the proper drivers installed, so it should be pretty easy.

But if you want to just spend a few bucks and rent an AWS GPU temporarily, you will probably have some issues following those instructions to install the Nvidia OpenCL libraries on a standard AWS Debian or Ubuntu image. Maybe you landed here because you got one of these errors:

Package nvidia-opencl-icd is a virtual package provided by:
nvidia-opencl-icd-384 384.130-0ubuntu0.16.04.1
nvidia-opencl-icd-340 340.104-0ubuntu0.16.04.1
nvidia-opencl-icd-304 304.135-0ubuntu0.16.04.2
You should explicitly select one to install.
E: Unable to locate package nvidia-opencl-common
E: Package 'nvidia-opencl-icd' has no installation candidate

Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
nvidia-opencl-dev : Conflicts: opencl-dev
ocl-icd-opencl-dev : Conflicts: opencl-dev
Recommends: libpoclu-dev but it is not installable
E: Unable to correct problems, you have held broken packages.

[email protected]:~/scallion-v2.0$ mono scallion.exe -l
WARNING: The runtime version supported by this application is unavailable.
Using default runtime: v4.0.30319
beignet-opencl-icd: no supported GPU found, this is probably the wrong opencl-icd package for this hardware
(If you have multiple ICDs installed and OpenCL works, you can ignore this message) Unhandled Exception:
System.InvalidOperationException: ErrorCode:'-1'
at scallion.CLDeviceInfo.CheckError (Int32 err) <0x41448340 + 0x00093> in :0
at scallion.CLDeviceInfo.GetDeviceIds (IntPtr platformId, DeviceTypeFlags deviceType) <0x41449290 + 0x00055> in :0

Figuring out dependencies sucks. Dealing with Linux drivers sucks. So instead of that, you should use an OS image where someone has already done this for you! You would think that maybe AWS would suggest this to you when using a GPU instance, since you can’t very well use it without the GPU libraries, but here we are.

Just search for “GPU” when selecting your AMI and you will be much happier than if you tried to install this stuff yourself. Install the rest of the packages mentioned in that other post (namely: $ sudo apt-get install clinfo mono-complete mono-devel beignet beignet-dev libssl-dev) and hopefully you should be good to go.

One final note: you can download binary packages from Scallion’s GitHub rather than compiling it yourself. Given that it uses .NET for some reason, cutting out some of the Mono build stuff also saves you one step that could go wrong on Linux

$ mono scallion.exe -l
WARNING: The runtime version supported by this application is unavailable.
Using default runtime: v4.0.30319
Id:0 Name:Tesla M60
PreferredGroupSizeMultiple:32 ComputeUnits:16 ClockFrequency:1177
MaxConstantBufferSize:65536 MaxConstantArgs:9 MaxMemAllocSize:1997225984

$ mono scallion.exe -t4 -d 0 melon
WARNING: The runtime version supported by this application is unavailable.
Using default runtime: v4.0.30319
Cooking up some delicions scallions…
Using kernel optimized from file kernel.cl (Optimized4)
Using work group size 32
Compiling kernel… done.
Testing SHA1 hash…
CPU SHA-1: d3486ae9136e7856bc42212385ea797094475802
GPU SHA-1: d3486ae9136e7856bc42212385ea797094475802
Looks good!
...
LoopIteration:5 HashCount:83.89MH Speed:1398.1MH/s Runtime:00:00:00 Predicted:00LoopIteration:6 HashCount:100.66MH Speed:1398.1MH/s Runtime:00:00:00 Predicted:00:00:00 Found new key! Found 1 unique keys.

2019-02-16T08:01:41.734936Z
melonqgytws2cgwh.onion
-----BEGIN RSA PRIVATE KEY-----