Finding a document with a given hashed value

Course: Information Security
Project: Stock Price Checker

Issue: Finding a document in DB with a given hashed value

So for this project, each IP address can “like” each stock only once. In order to enforce this, I need to check the DB if a given IP address has already “liked” a given stock.

But since I encrypt IP addresses before storing them, I can’t simply use “Like.find()” and pass in the plain IP address. I could retrieve all the “like” documents and compare the hashed IP addresses to the target IP address but that would take way too long. Is there a better way to accomplish this? Thanks in advance.

My Like Schema:

const likeSchema = new Schema({
  ipAddress: {type: String, required: true},
  ticker: {type: String, required: true}
1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.