Generate SHA1 with a certain prefix
up vote
-1
down vote
favorite
I was wondering if there is an algorithm that I can use in order to generate a SHA1 string with a certain prefix by starting from a certain string:
const prefix = '0a12'
const prefix_sha = '111'
suffix = random_str()
while not SHA1(prefix + suffix).starts(prefix_sha):
suffix = update_suffix(suffix)
For example, in this case, the loop must exit when we found an hash which starts with 111
. For the hash function I'm using this:
hashlib.sha1(s.encode('utf-8')).hexdigest()
where s
is a string.
cryptography sha1
|
show 11 more comments
up vote
-1
down vote
favorite
I was wondering if there is an algorithm that I can use in order to generate a SHA1 string with a certain prefix by starting from a certain string:
const prefix = '0a12'
const prefix_sha = '111'
suffix = random_str()
while not SHA1(prefix + suffix).starts(prefix_sha):
suffix = update_suffix(suffix)
For example, in this case, the loop must exit when we found an hash which starts with 111
. For the hash function I'm using this:
hashlib.sha1(s.encode('utf-8')).hexdigest()
where s
is a string.
cryptography sha1
What is the aim?
– kelalaka
Nov 4 at 12:01
What is the aim of your question?
– Surcle
Nov 4 at 12:15
SHA1 is shattered, but this is different, and you are the one seeking an answer here. The code you write gives no information at all, where is SHA1?
– kelalaka
Nov 4 at 12:19
1
I assume this question is a duplicate of crypto.stackexchange.com/questions/22736/sha1-partial-collision
– Robert
Nov 4 at 12:22
I updated the pseudocode
– Surcle
Nov 4 at 12:23
|
show 11 more comments
up vote
-1
down vote
favorite
up vote
-1
down vote
favorite
I was wondering if there is an algorithm that I can use in order to generate a SHA1 string with a certain prefix by starting from a certain string:
const prefix = '0a12'
const prefix_sha = '111'
suffix = random_str()
while not SHA1(prefix + suffix).starts(prefix_sha):
suffix = update_suffix(suffix)
For example, in this case, the loop must exit when we found an hash which starts with 111
. For the hash function I'm using this:
hashlib.sha1(s.encode('utf-8')).hexdigest()
where s
is a string.
cryptography sha1
I was wondering if there is an algorithm that I can use in order to generate a SHA1 string with a certain prefix by starting from a certain string:
const prefix = '0a12'
const prefix_sha = '111'
suffix = random_str()
while not SHA1(prefix + suffix).starts(prefix_sha):
suffix = update_suffix(suffix)
For example, in this case, the loop must exit when we found an hash which starts with 111
. For the hash function I'm using this:
hashlib.sha1(s.encode('utf-8')).hexdigest()
where s
is a string.
cryptography sha1
cryptography sha1
edited Nov 7 at 7:52
asked Nov 4 at 11:53
Surcle
18913
18913
What is the aim?
– kelalaka
Nov 4 at 12:01
What is the aim of your question?
– Surcle
Nov 4 at 12:15
SHA1 is shattered, but this is different, and you are the one seeking an answer here. The code you write gives no information at all, where is SHA1?
– kelalaka
Nov 4 at 12:19
1
I assume this question is a duplicate of crypto.stackexchange.com/questions/22736/sha1-partial-collision
– Robert
Nov 4 at 12:22
I updated the pseudocode
– Surcle
Nov 4 at 12:23
|
show 11 more comments
What is the aim?
– kelalaka
Nov 4 at 12:01
What is the aim of your question?
– Surcle
Nov 4 at 12:15
SHA1 is shattered, but this is different, and you are the one seeking an answer here. The code you write gives no information at all, where is SHA1?
– kelalaka
Nov 4 at 12:19
1
I assume this question is a duplicate of crypto.stackexchange.com/questions/22736/sha1-partial-collision
– Robert
Nov 4 at 12:22
I updated the pseudocode
– Surcle
Nov 4 at 12:23
What is the aim?
– kelalaka
Nov 4 at 12:01
What is the aim?
– kelalaka
Nov 4 at 12:01
What is the aim of your question?
– Surcle
Nov 4 at 12:15
What is the aim of your question?
– Surcle
Nov 4 at 12:15
SHA1 is shattered, but this is different, and you are the one seeking an answer here. The code you write gives no information at all, where is SHA1?
– kelalaka
Nov 4 at 12:19
SHA1 is shattered, but this is different, and you are the one seeking an answer here. The code you write gives no information at all, where is SHA1?
– kelalaka
Nov 4 at 12:19
1
1
I assume this question is a duplicate of crypto.stackexchange.com/questions/22736/sha1-partial-collision
– Robert
Nov 4 at 12:22
I assume this question is a duplicate of crypto.stackexchange.com/questions/22736/sha1-partial-collision
– Robert
Nov 4 at 12:22
I updated the pseudocode
– Surcle
Nov 4 at 12:23
I updated the pseudocode
– Surcle
Nov 4 at 12:23
|
show 11 more comments
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53140536%2fgenerate-sha1-with-a-certain-prefix%23new-answer', 'question_page');
}
);
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
What is the aim?
– kelalaka
Nov 4 at 12:01
What is the aim of your question?
– Surcle
Nov 4 at 12:15
SHA1 is shattered, but this is different, and you are the one seeking an answer here. The code you write gives no information at all, where is SHA1?
– kelalaka
Nov 4 at 12:19
1
I assume this question is a duplicate of crypto.stackexchange.com/questions/22736/sha1-partial-collision
– Robert
Nov 4 at 12:22
I updated the pseudocode
– Surcle
Nov 4 at 12:23