Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9025535
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T06:17:45+00:00 2026-06-16T06:17:45+00:00

I’m writing my own list manager and I need a simple short URL for

  • 0

I’m writing my own list manager and I need a simple short URL for users to “one click” to unsubscribe, e.g. http://unsubscribe.example.com/50d178fa

50d178fa is just a hex of epoch, which is too guessable I like to think. One could be malicious and just unsubscribe people by correctly guessing the hex for a certain time period.

So I’m looking for some light protection. xor seems simplest. Any other “suck less” suggestions using a secret that generates an “unguessable string” not longer than 8 characters that I might be missing?

    epoch=$(date +%s)
    hex=$(printf '%x' $epoch)
    echo Convert epoch to hex
    echo d:$epoch h:$hex

    echo h:$hex is ${#hex} characters long

    echo Conversion from hex back to epoch
    echo h:$hex d:$(printf "%dn" 0x$hex)

    n=911 # secret number

    obfuscated=$(($epoch ^ $n))
    obfuscatedhex=$(printf '%x' $obfuscated)
    echo d:$obfuscated, h:$obfuscatedhex is ${#obfuscatedhex} characters long
    echo Conversion from hex back to epoch
    echo $(($(printf "%dn" 0x$obfuscatedhex) ^ $n))
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T06:17:46+00:00Added an answer on June 16, 2026 at 6:17 am
    head -c 4 /dev/urandom | xxd -p
    

    To expand, xor is not very good for obfuscating if you xor against the same thing every time. If someone gets a few examples of these links, they will get a ^ n, b ^ n, c ^ n, for a, b, and c, which are times (and thus, will generally only differ in the last few bits). They can calculate (a ^ n) ^ (b ^ n) = (a ^ b) ^ (n ^ n) = (a ^ b), which will show them just the bits that differ between a and b. If they do the same with c and either of those, they’ll realize that it’s just the low-order bits which differ in each case. So they can take the values they have, and start guessing by flipping low-order bits. xor against a secret hasn’t actually bought you any protection from someone trying to guess values; flipping a few low-order bits is just as easy for timestamps xored against a fixed value as it is against the timestamp directly.

    For it to be secure, you need to use a different value every time; a one time pad, in which you use a different, secure, random number each time, or a function that can securely generate a new value from a key. In the first case, if you’re using a new random number each time, why not just use that number as the key? In the second, you would need to use a stream cipher, which generates a pseudorandom stream that you could use for xoring your output from a secret key that you hold. But you would then need to keep track of where you were in that stream; if you ever repeat the stream, you run into the same old problem that you had, so this approach is much more complicated and delicate.

    You already have a good, easy to use source of cryptographically secure unguessable values in /dev/urandom. You might as well use that. Just store the random value per subscriber; it’s just 4 bytes per subscriber (or 8 if you store the hex value). Now, 32 bits is not great security; with enough tries, there’s a good chance that someone could unsubscribe someone else. But if you do anything to rate-limit attempts, it shouldn’t be too bad. And you can always easily increase the security by just fetching more bytes for each link.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
I'm making a simple page using Google Maps API 3. My first. One marker
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
In my XML file chapters tag has more chapter tag.i need to display chapters
I am doing a simple coin flipping experiment for class that involves flipping a
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
i got an object with contents of html markup in it, for example: string
I need a function that will clean a strings' special characters. I do NOT

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.