|
-
May 10th, 2007, 01:34 PM
#1
Thread Starter
Fanatic Member
Line crossing X question
Hi all,
I have 2 questions that are roughly the same thing
1) if i take a number lets say 44. is there an easy way to pick two random points along a random line ( i guess random slope of a line since it has to go through 44)
2) what is the equation for taking two points x1,y1 and x2,y2 and resolving the X intersect out of it ( probably much easier)
Thanks
Robert
-
May 10th, 2007, 01:46 PM
#2
Thread Starter
Fanatic Member
Re: Line crossing X question
The idea behind it is
that lets say 44 is a password
if i run a random line that passes throgh x at 44 and take two random points on that line
i give one guy one set of points x1,y1
and another guy the other set x2,y2
and there is no way that just one can figure out what the password is unless they talk to each other.
or i keep on set hidden and give one to another party in the event of my death the two will talk and get the password use your imagination
obvouisly the point would have to be much larger than 44 but the theory seems sound
-
May 11th, 2007, 03:48 AM
#3
Re: Line crossing X question
if i run a random line that passes throgh x at 44
What shall this tell us? What are the coordinates for this point? (x= 44; y=???)
Even if you have the coordinate data for both points, how will you decide which point on the connecting line will be your "password", if you only look for an x-value?
You're welcome to rate this post!
If your problem is solved, please use the Mark thread as resolved button
Wait, I'm too old to hurry!
-
May 12th, 2007, 01:35 PM
#4
Thread Starter
Fanatic Member
Re: Line crossing X question
im not sure i have conveyed my point properly
i don't need to know what y is it doesn't matter
lets say we use your pin number for the atm 3498(just makeing it up obviously)
so to "split" the pin in two so that no one person can figure it out on there own we would:
1) make X= 3498
2) draw a line with a random slope through X
3) take two( or more) random points from that line
4) give person 1 points 45,23 and person two -12,34 (agian just makeing it up)
to decode
they two meet up and input there coordinates and it draws a line
the line passes X at point 3498 and VOLA they have the password
now obviously you wouldn't want to use this for your pin i jsut used it as an example but it would be nice at work if you had a system that one department is not supposed to access with out a member of a diffrent department.
-
May 12th, 2007, 01:39 PM
#5
Re: Line crossing X question
Maybe I'm stupid, but how do do calculate the X out of those two other numbers??
You're welcome to rate this post!
If your problem is solved, please use the Mark thread as resolved button
Wait, I'm too old to hurry!
-
May 13th, 2007, 11:33 PM
#6
Thread Starter
Fanatic Member
Re: Line crossing X question
Slope m = (Y2-Y1)/(X2-X1)
Take the equation y = m x + b
-
May 13th, 2007, 11:35 PM
#7
Thread Starter
Fanatic Member
Re: Line crossing X question
I guess the idea needs to be broken down into two sub ideas
1) How can i "draw" a line that intersects x at a given value
2) How can i get x, y coronate values from a line
-
May 14th, 2007, 12:26 AM
#8
Re: Line crossing X question
Question 2 is easily answered:
Using the formula y=ax +b, you can calculate y for any value of x. But that's the problem I have with your approach, you need an x-value to look for the correspondent y-value, or vice versa.
The approach to start with an x-value and then draw a "random" slope thru the point (a point has a x and y-values!) doesn't make sense to me!
The decoding approach is also unclear, you have two points from this line, but you save only one value for each of those points
(
give person 1 points 45,23 and person two -12,34
)
There is no way to calaculate anything out of two x-values if you don't have the y-values!
You're welcome to rate this post!
If your problem is solved, please use the Mark thread as resolved button
Wait, I'm too old to hurry!
-
May 14th, 2007, 01:34 AM
#9
Thread Starter
Fanatic Member
Re: Line crossing X question
sorry must be a American thing
give person 1 points 45,23 and person two -12,34
x45, y23
x-12, y23
-
May 14th, 2007, 05:30 AM
#10
Re: Line crossing X question
OK, that solves one problem, but how could you calculate out of those two points your desired x value, in my opinion you need an y value for that!
You have:
x1 = 45, y1 = 23
x2 = -12, y2 = 34
that makes this line-equation:
m = (Y2-Y1)/(X2-X1)= (34- 23)/ (-12 -45) = 11/ -57 = -0.19....
y = -0.19...x + b
23 = -0.19....(45) +b
b= 31.68....
y=0.19..x +31.68... is your formula.
Just tell me how to get a value for x, without giving a value for y!
Last edited by opus; May 14th, 2007 at 05:38 AM.
You're welcome to rate this post!
If your problem is solved, please use the Mark thread as resolved button
Wait, I'm too old to hurry!
-
May 14th, 2007, 03:01 PM
#11
Frenzied Member
Re: Line crossing X question
 Originally Posted by Crash893
2) what is the equation for taking two points x1,y1 and x2,y2 and resolving the X intersect out of it ( probably much easier)
You would need the slope used for each point (2 different slope values). Once you have that, you could create two slope point equations and set them equal to find the intersection(s).
Just given 2 different points doesn't help. You could create a formula, but there would be like 2 unknowns!
I don't know, maybe I'm just over-complicating things.
-
May 17th, 2007, 02:17 AM
#12
Thread Starter
Fanatic Member
Re: Line crossing X question
sorry im not good at explaining these thing i dont understand them that well my self
you are only trying to solve for where this line cross's X
X=??? y=0
-
May 17th, 2007, 02:19 AM
#13
Thread Starter
Fanatic Member
Re: Line crossing X question
to decode
answer = (((X2 - X1)*(0 - Y2)) / (Y2 - Y1)) + X2;
-
May 18th, 2007, 01:15 AM
#14
Re: Line crossing X question
Now you are coming clear, your X is not a point it is the horizontal vertex! In this case y is given to be 0 all the time!
Let me rephrase yopur problem:
You have a number that needs to be secret.
You want to create two seperate coordinates (set of two numbers) that would together specifiy the secret number, but would be useless on their own.
To create the two seperate coordinates you use a random slope (m) thru the coordinate x = The secret Number and y = 0. (formula y = mx +b ). The value for the additon (b) can be calculated like:
b= - mx
NOTE: m<>0!
Having this formula, you can select two random x-values, for those you can calculate the corresponding y-values. You have your seperate coordinates now.
With one coordinate alone, nothing could be computed, using both the value of the secret number is easily computed.
The calculation:
Starting with x1, y1 and x2, y2
calculate Slope(m)
m = (y2 - y1) / (x2 - x1)
calculate b:
b = y1 - m*x1 or b = y2 - m*x2
calculate the secret number (X), remeber Y is always 0:
0 = m*X +b
X = -(b/m)
X =-( (y1 - (y2 - y1)/(x2 - x1)*x1) / ((y2 - y1)/(x2 - x1)))
X = -(y1 / ((y2 - y1)/(x2 - x1)) + ((y2 - y1)/(x2 - x1)*x1)/((y2 - y1)/(x2 - x1))
X = x1*(((y2 - y1)/(x2 - x1))/((y2 - y1)/(x2 - x1))) - (y1 / ((y2 - y1)/(x2 - x1))
X = x1 - (y1 / ((y2 - y1)/(x2 - x1))
For example:
Secret Value X =1234
Random Slope(m) = 23
Addition (b)= -28382
Random values for x1= 1000 and x2=-500
Calculate y1= -5382 and y2= -39882
Recalulation of X
X = x1 - (y1 / ((y2 - y1)/(x2 - x1))
X = 1000 - (-5382 / ((-39882--5382)/(-500-1000)) = 1234
Although this example came up with integer values only, you have to expect non-integer values for the y1 and y2 values!
You're welcome to rate this post!
If your problem is solved, please use the Mark thread as resolved button
Wait, I'm too old to hurry!
-
May 22nd, 2007, 03:15 AM
#15
Thread Starter
Fanatic Member
Re: Line crossing X question
wow
thanks
yea im not a mathy type person so some times i have trouble explaining what im trying to do
also there is a version of this idea that uses porabola's
where 3 cordnates are given to solve for x
-
May 22nd, 2007, 03:40 AM
#16
Re: Line crossing X question
If your question is answered, please use the thread tools to mark this thread as resolved (I'd suggest to start a new threat if you need help with this parabola thing).
And you might give aweay a positve rating to a person that did help you;-)
You're welcome to rate this post!
If your problem is solved, please use the Mark thread as resolved button
Wait, I'm too old to hurry!
-
May 22nd, 2007, 12:20 PM
#17
Thread Starter
Fanatic Member
Re: Line crossing X question
rateings away!
however i still havent had a chance use all the info in this tread yet
when im done it will be resolved
-
May 24th, 2007, 07:21 AM
#18
New Member
Re: Line crossing X question
I might be wrong, and I haven't read all the replies, but if you just give two people two points on the line, then your hidden number can still be any one of an infinite number of points on this line segment, can't it? You'd need two separate equations for lines such that they intersect at 44.
-
May 25th, 2007, 12:18 AM
#19
Re: Line crossing X question
 Originally Posted by hippolyta
I might be wrong, and I haven't read all the replies...
Somewhere down the road, he made clear that his secret value is a coordinate like (x; 0). With that information, the problem is easy to solve!
You're welcome to rate this post!
If your problem is solved, please use the Mark thread as resolved button
Wait, I'm too old to hurry!
-
May 29th, 2007, 08:26 PM
#20
Thread Starter
Fanatic Member
Re: Line crossing X question
Just fyi here is the code that i've kinda of got workign
It works out to a point i am still having trouble working with larger numbers that i will need for it to work in the wild but now simple 15 digit numbers work fine.
Encryption
c# Code:
Random random = new Random();
double X1, X2, X3, Y1, Y2, Y3;
//STEP3 MAKE RANDOM PNT1
X1 = random.Next(2,100);
Y1 = random.Next(2,100);
//STEP2 MAKE PNT2 WITH CONSTANT ( FROM TEXT BOX)
X2 = Convert.ToDouble(textBox7.Text);
Y2 = 0;
//X3 = 1;
//Y3 = 1;
//STEP4 GET SLOPE FROM PNT1 AND PNT2
double slope = (Y2 - Y1) / (X2 - X1);
double t = random.Next(2,100);
double b = Y1 - slope * X1;
//STEP5 GET RANDOM POINT ALONG LINE MADE PNT1 AND PNT2
X3 = random.Next(100);
Y3 = slope * X3 + b;
//float p = random.Next(1);
// X3 = X1+(1-p)*X2;
// Y3 = p * Y1 + (1 - p) * 2;
//OUTPUT TO TEXTBOX
textBox5.Text = t.ToString();
textBox6.Text = slope.ToString();
textBox1.Text = X1.ToString();
textBox2.Text = Y1.ToString();
textBox3.Text = X2.ToString();
textBox4.Text = Y2.ToString();
textBox9.Text = X3.ToString();
textBox8.Text = Y3.ToString();
Decryption
c# Code:
double X1, X2, Y1, Y2, answer;
X1 = Convert.ToDouble(textBox15.Text);
Y1 = Convert.ToDouble(textBox16.Text);
X2 = Convert.ToDouble(textBox10.Text);
Y2 = Convert.ToDouble(textBox11.Text);
answer = (((X2 - X1) * (0 - Y2)) / (Y2 - Y1)) + X2;
textBox12.Text = Convert.ToDouble( answer).ToString();
-
Jun 3rd, 2007, 05:33 PM
#21
Re: Line crossing X question
I might not understand entirely, but is the user given the two random coordinates or is there any way for him to extract them?
If so, they could just try 2 times, get 2 different lines both times... the point where these lines will interesect will be your password, no? Easy to find then!
-
Jun 4th, 2007, 02:13 PM
#22
Thread Starter
Fanatic Member
Re: Line crossing X question
no
1 set = random
2set = random along the line
you only give 1 set to each party
Last edited by Crash893; Jan 22nd, 2008 at 07:41 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|