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 6949963
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T14:01:45+00:00 2026-05-27T14:01:45+00:00

I am trying to develop a website and a corresponding helper program (installed on

  • 0

I am trying to develop a website and a corresponding helper program (installed on the user computer). The website and the program will communicate with each other (AJAX mostly), but it will be a large security risk if any other web page can send requests to the program. I want to come up with a solution which makes it extremely hard to inject fraud requests to my program (installed on the user computer). My thoughts are about to use one time passwords, but I have limited security knowledge and therefore ask you for your thoughts.

I have came up with this One-Time-Password algorithm (pseudo):

function otp(seed, counter, unix_timestamp, action)
{
    for(i = 0; i < counter; ++i)
    {
        seed = sha256(seed + i);
    }
    str = seed;

    str = sha256(str + unix_timestamp/60);
    str = sha256(str + action);
    otp = substr(str,0,4); //Convert the first for bytes to an int.
    return (int)otp;
}

It should have the following properties:

  • Can only be used once, (On every otp generation will “counter” be increased => new seed)
  • Will be changed every minute (It depends on time).
  • Bound to an action (login, …), it depends on a specific action.
  • Can easily be generated separately and later be synchronized.

If every request contains OTP code and counter value, is this secure? If not what are your tips to accomplish this? I really want all those properties I mentioned above.

Thanks in advance.

  • 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-05-27T14:01:46+00:00Added an answer on May 27, 2026 at 2:01 pm

    Your approach is sensible in principle. Keep in mind, however, that multiple calls to your hash function are pointless – either it’s secure on the first pass, or it isn’t at all.
    Also, you are right now only using the seed to actually authenticate requests (anything else would be known to a would-be attacker), and any weakness in seed generation becomes a weakness in authentication.

    I am not aware of the specific shortcomings of SHA256. However, your problem in general is fairly common and is much easier to describe and solve in standard terms. You want to authenticate a request to your program. Your remote program needs to securely determine the authenticity of a request. This problem is most easily solved with public-key cryptography. For example, make a GnuPG key pair, keep the private key at your website and distribute the public key with your program, and sign any command you send to the program with the private key. The client program receives requests normally and only needs to verify their authenticity via a single call to GnuPG.

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

Sidebar

Related Questions

So I am trying to develop a program that will parse a website for
I am trying develop a basic referrer system to my Django website, system will
I'm trying to develop a plugin that shows website screenshot, when a user clicks
I'm trying to use xcode to develop a website. Installed the cappuccino plugin but
So I am trying to develop a simple mobile website. It will go off
I'm trying to develop a layout for my website in which elements of a
I'm trying to develop an application that will use getImageData in javascript in Firefox
I'm new to Codeigniter and I'm trying to develop a simple website with a
I'm currently trying to develop a messaging system for my website. So far the
I am trying to develop auto horizontal scrolling for our website using - jQuery.ScrollTo

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.