Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hash improvement #528

Merged
merged 3 commits into from
Mar 1, 2022
Merged

hash improvement #528

merged 3 commits into from
Mar 1, 2022

Conversation

LuitelSamikshya
Copy link
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
@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
Copy link
Member

@ehsandeep ehsandeep left a comment

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]

Copy link
Member

@ehsandeep ehsandeep left a comment

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
Copy link
Contributor

M09Ic commented Feb 26, 2022

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

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