How to find out if your Linkedin password was found via PowerShell

First you need to download the combo_not.zip file and unpack it.
(for example read the comments on this post: http://tweakers.net/nieuws/82411/wachtwoorden-miljoenen-linkedin-gebruikers-op-straat.html )

Next drop the combo_not.txt file in your C:\ drive: C:\combo_not.txt

Now open PowerShell or PowerShell ISE and run the PowerShell script below:
(don’t forget to change YourPasswordHere):

cd c:\
$pass = "YourPasswordHere"
$sha1 = [System.Security.Cryptography.SHA1]::Create()
$bytes = [System.Text.Encoding]::UTF8.GetBytes($pass)
$hashArray = $sha1.ComputeHash($bytes)
$hashArray | foreach -Begin{$str=''} -Process{$str += "{0:x2}" -f $_} -End{$str}
$str2 = [String]::Concat("00000", $str.Substring(5))
findstr -I $str .\combo_not.txt
findstr -I $str2 .\combo_not.txt

I tested it and didn’t give a result, so that must be a good thing ;-) (let’s hope it is not due to this quick script :-) )

LinkedIn commented on the stolen passwords/hashes. Read it here: http://blog.linkedin.com/2012/06/06/linkedin-member-passwords-compromised/

Update: apprently the first 5 bits need to be set to 0 to do another check if it is hacked
Update2: updated the script
Update3: reply from LinkedIn

Please post a comment if there are any suggestions/mistakes.

Learn more about the PowerShell pipeline script function: begin, process and end:

Perl: Storing arrays in hashes

Let’s start with a quote from ‘Learning Perl‘:

What Is a Hash?

A hash is a data structure, not unlike an array in that it can hold any number of values and retrieve them at will. But instead of indexing the values by number, as we did with arrays, we’ll look up the values by name. That is, the indices (here, we’ll call them keys ) aren’t numbers, but instead they are arbitrary unique strings

hash

 

Our goal: We want to store an array as a value in the hash instead of saving a single value.

Let’s write some code:

#!/usr/bin/perl
use strict;
use warnings;

my %hash = ();
my @array = (1, 2, 3, 4, 5);
my $aref = \@array;
$hash{"Testing"} = $aref;
push(@{$hash{"Testing"}},6);
print join " ",@{$hash{"Testing"}};

This piece of Perl code stores an array as a value in a hash and adds a new element to the array.

Now let’s analyze the code.

First we create an empty hash and we create an array and initialize it.

my %hash = ();
my @array = (1, 2, 3, 4, 5);

empty-hash-and-array
Now we need a reference of our array (so that we can store it as a value in the hash):

my $aref = \@array;

reference to array
In the next step below we actually do what we wanted. Storing an array into a hash value. We create a key in our hash called “Testing” and store the reference of our array in the value field.

$hash{"Testing"} = $aref;

hash-array-ref2
We can see that the reference of our array ($aref) is pointing to our array so we can access the array in our hash. :)

This code adds a new element with value '6' to our array:
push(@{$hash{"Testing"}},6);

hash-aray-push-item

Explanation:

# Gives the value of key Testing, it's the reference to the array
$hash{"Testing"}

# Dereference it with {} to access the array (that's why we have an @ at the begin)
@{$hash{"Testing"}}

I hope that helped :)