Sign in or Sign up

Simple Python Hashing
Started by Bloodhound


Rate this topic
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5


9 posts in this topic
Bloodhound Offline
Python Enthusiast
****


Diamond
Posts: 105
Threads: 14
Joined: Thu Apr 2017
Reputation: 2

CZPoints: 6 CZP
ContributorDiamond
04-18-2017, 05:00 AM -
#1
Today I'll show you how to use blake2b which is the 64-bit variant of blake2 in the hashlib module included in the initial standard python library.

Hashlib provides a large range of encryption algorithms such as SHA1 and MD5. Although these algorithms don't have any customization. Whereas the blake2 algorithms allow for large customization which adds to the security of the hash. This makes the hash almost impossible to crack. 

This is the difference between blake2b and blake2s:
[Image: c53d97fa734940e1890944fe7f144288.png]
(The numbers are in bits)

An important thing to remember is that when hashing, it requires byte-like objects so make sure to always encode to something such as 'UTF-8'. 

Digest Size, Key, Salt and Person all add to the customization of this hashing algorithm.

Digest Size: Sets the length of the hash, for example digest_size=10 would output a hash with a length of 20 characters. 
Key, Salt, Person: This can be anything, it adds some security to the hash as it adds variation to the final hash. So if you were to hash with no key, salt or person, it would be quicker to crack.

Here I'll show you a simple program I made to show the hashing:
This is our program in action:
Now, we are going to use Digest Size to shorten this for the purpose of this thread. So here is the code:
And here is our output:
As you see the hash is different as we have changed the size. Exact same input but different output. Now I am going to show you how to include a key. Here is the code:
As you see, I had to encode the key into a byte-like object in order for the algorithm not to throw us an error. Here is our output:
Now, the key has customized our hash even more, if we were to remove the key, we would get the same hash as before. Now I am going to add Salt and Person to the hash as these steps are the same steps in order to include these arguments and it would be boring, me repeating the same thing. Here is our final code:
For the person, I decided to use the person's name. So even if the suspect had the key, digest size and salt, they would still need to know the person in order to then spend ALOT of time cracking the hash. Here is the output:
I hope you enjoyed this thread. It is one of my poorly explained threads I'll admit therefore if you require any more understanding or help, comment below or pm me. Thanks and share your opinions, support or criticism.
[Image: rElVjPf.png]
rustyarts Offline
Junior Member
**


Registered
Posts: 24
Threads: 5
Joined: Thu Apr 2017
Reputation: 0

CZPoints: 0 CZP
04-18-2017, 05:14 AM -
#2
Really nice thanks for everything <3
ScorpionOfWar Offline
Super Moderator
******


Super Moderators
Posts: 239
Threads: 11
Joined: Fri Mar 2017
Reputation: 14

CZPoints: 38 CZP
Contributor
04-18-2017, 06:13 AM -
#3
Thank you for sharing this with us! Nice tutorial
[Image: PWXNX5p.gif]

Discord - @ScorpionOfWar#0001
Bloodhound Offline
Python Enthusiast
****


Diamond
Posts: 105
Threads: 14
Joined: Thu Apr 2017
Reputation: 2

CZPoints: 6 CZP
ContributorDiamond
04-19-2017, 01:07 PM -
#4
Appriciate the support, thanks!
[Image: rElVjPf.png]
Dox Offline
Cyber Security Student
***


Contributor
Posts: 414
Threads: 125
Joined: Mon Oct 2017
Reputation: 6

CZPoints: 134 CZP
OnFireContributor
10-25-2017, 01:49 PM -
#5
Pretty fucking HQ man. Please keep up this format when creating threats or tuts <3
Contact E-Mail: [email protected]
BTC Address: 1JmJrbmQn4Bg24r68bSyZ7TxNZGad3iPWM
TWS Offline
Junior Member
**


Registered
Posts: 14
Threads: 3
Joined: Fri Nov 2017
Reputation: 3

CZPoints: 7 CZP
11-03-2017, 05:07 PM -
#6
very nice op but I do have one observation I don't think it would be to hard for someone to decode utf-8 unicode just a small detail I picked up but I know this article your sharing with us does not cover that area, so in my mind my observation is just that of not being very observant tonight.
Bloodhound Offline
Python Enthusiast
****


Diamond
Posts: 105
Threads: 14
Joined: Thu Apr 2017
Reputation: 2

CZPoints: 6 CZP
ContributorDiamond
11-06-2017, 12:21 AM -
#7
(11-03-2017, 05:07 PM)TWS Wrote: very nice op but I do have one observation I don't think it would be to hard for someone to decode utf-8 unicode just a small detail I picked up but I know this article your sharing with us does not cover that area, so in my mind my observation is just that of not being very observant tonight.

It's encoded to UTF-8 so it is then the correct data-type for the hashing algorithm to use, there is no need for someone to decode from UTF-8 unless they want to break the program.
[Image: rElVjPf.png]
TWS Offline
Junior Member
**


Registered
Posts: 14
Threads: 3
Joined: Fri Nov 2017
Reputation: 3

CZPoints: 7 CZP
11-06-2017, 07:50 AM -
#8
(11-06-2017, 12:21 AM)Bloodhound Wrote:
(11-03-2017, 05:07 PM)TWS Wrote: very nice op but I do have one observation I don't think it would be to hard for someone to decode utf-8 unicode just a small detail I picked up but I know this article your sharing with us does not cover that area, so in my mind my observation is just that of not being very observant tonight.

It's encoded to UTF-8 so it is then the correct data-type for the hashing algorithm to use, there is no need for someone to decode from UTF-8 unless they want to break the program.

please excuse my half brain dead question I was half asleep asking you that and only zero'd in on that particular detail.
Bloodhound Offline
Python Enthusiast
****


Diamond
Posts: 105
Threads: 14
Joined: Thu Apr 2017
Reputation: 2

CZPoints: 6 CZP
ContributorDiamond
11-06-2017, 04:06 PM -
#9
(11-06-2017, 07:50 AM)TWS Wrote: please excuse my half brain dead question I was half asleep asking you that and only zero'd in on that particular detail.

No worries, I feel like this 90% of the time myself
[Image: rElVjPf.png]
Corruption Offline
Administrator
*******


Administrators
Posts: 291
Threads: 67
Joined: Fri Mar 2017

CZPoints: 119 CZP
12-01-2017, 11:08 PM -
#10
Awesome thread man <3






Users browsing this thread: 1 Guest(s)