Skip to content

hash improvement - #528

Merged
ehsandeep merged 3 commits into
devfrom
hash-improvement
Mar 1, 2022
Merged

ehsandeep merged 3 commits into
devfrom
hash-improvement

Conversation

@LuitelSamikshya

Copy link
Copy Markdown
Contributor

No description provided.

@LuitelSamikshya LuitelSamikshya self-assigned this Feb 25, 2022
@LuitelSamikshya LuitelSamikshya linked an issue Feb 25, 2022 that may be closed by this pull request
4 tasks done
@LuitelSamikshya LuitelSamikshya added Type: Enhancement Most issues will probably ask for additions or changes. Status: Review Needed The issue has a PR attached to it which needs to be reviewed labels Feb 25, 2022

@ehsandeep ehsandeep left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is slight change on mmh3 hash genration with favicon flag vs the default one, the default one can be adapted to mimic the pythoic (-favicon) mmh3 hash.

echo https://mta-sts.forwarding.hackerone.com/favicon.ico | ./httpx -hash mmh3 -silent
https://mta-sts.forwarding.hackerone.com/favicon.ico [2594644036]

echo https://mta-sts.forwarding.hackerone.com | ./httpx -favicon -silent
https://mta-sts.forwarding.hackerone.com/favicon.ico [-1700323260]

@ehsandeep ehsandeep left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As it's unclear the types of hashes are supported, this information can be made available to help menu by printing hashType

-hash string         Display response body hash (supported: md5,mmh3,sha256,sim)

@M09Ic

M09Ic commented Feb 26, 2022

Copy link
Copy Markdown
Contributor
https://mta-sts.forwarding.hackerone.com/favicon.ico

This bug is because I forgot to convert the final mmh3 hash to int32.

just change:
common/hashes/Mmh3

func Mmh3(data []byte) string {
	var h32 = murmur3.New32WithSeed(0)
	h32.Write(stdBase64(data))
	return fmt.Sprintf("%d", int32(h32.Sum32()))
}

test:
echo "https://www.bilibili.com/" | httpx -favicon -hash mmh3

https://www.bilibili.com/favicon.ico [-1825654886] [-1825654886]

@sonarqubecloud

Copy link
Copy Markdown

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

0.0% 0.0% Coverage
0.0% 0.0% Duplication

@ehsandeep ehsandeep linked an issue Mar 1, 2022 that may be closed by this pull request
@ehsandeep
ehsandeep merged commit 03ded97 into dev Mar 1, 2022
@ehsandeep
ehsandeep deleted the hash-improvement branch March 1, 2022 06:35
@ehsandeep ehsandeep added Status: Completed Nothing further to be done with this issue. Awaiting to be closed. and removed Status: Review Needed The issue has a PR attached to it which needs to be reviewed labels Mar 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Status: Completed Nothing further to be done with this issue. Awaiting to be closed. Type: Enhancement Most issues will probably ask for additions or changes.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Hash generation improvements favicon: automatically detect favicons & calculate mmh3

4 participants