an observation

Share your advanced PureBasic knowledge/code with the community.
alokdube
Enthusiast
Enthusiast
Posts: 148
Joined: Fri Nov 02, 2007 10:55 am
Location: India
Contact:

an observation

Post by alokdube »

z1=a^x mod p
z2=a^y mod p
s1=(a^x mod p)^y mod p = a^xy mod p

say we know x1 for which z1 is true

z3=a^u mod p

s2=(a^u mod p)^x mod p = a^xu mod p


a=7 p =11


;
z1=a^x mod p
z1=3
possible values of x
4,14,24,34,44,54,64,74,84,94
;

z2=a^y mod p
z2=5
possible values of y
2,12,22,32,42,52,62,72,82,92,
;

z=a^xy mod p=7^8 mod 11 = 9
z=a^xy mod p=7^28 mod 11 = 9
z=a^xy mod p =7^48 mod 11 = 9
z=a^xy mod p=7^168 mod 11 = 9

Generically
if z1=a^x1 mod p =a^x2 mod p
and
z2=a^y1 mod p =a^y2 mod p
then
z=a^(x1y1) mod p = a^(x1y2) mod p =a^(x2y1) mod p = a^(x2y2) mod p and so on.
User avatar
idle
Always Here
Always Here
Posts: 5094
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Post by idle »

Thanks for sharing, I'm a bit slow in the head so can you explain what's this useful for?
User avatar
pdwyer
Addict
Addict
Posts: 2813
Joined: Tue May 08, 2007 1:27 pm
Location: Chiba, Japan

Post by pdwyer »

Kind of reminds me of Diffie-Hellman key exchange
Paul Dwyer

“In nature, it’s not the strongest nor the most intelligent who survives. It’s the most adaptable to change” - Charles Darwin
“If you can't explain it to a six-year old you really don't understand it yourself.” - Albert Einstein
User avatar
Rook Zimbabwe
Addict
Addict
Posts: 4326
Joined: Tue Jan 02, 2007 8:16 pm
Location: Cypress TX
Contact:

Post by Rook Zimbabwe »

This would be a tip? or a trick?

As it is, I see nothing useful yet...
z1=a^x % p
z2=a^y % p
s1=(a^x % p)^y % p = a^xy % p
Looks almost recursive? :D for infinite values of a I mean
Binarily speaking... it takes 10 to Tango!!!

Image
http://www.bluemesapc.com/
User avatar
idle
Always Here
Always Here
Posts: 5094
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Post by idle »

Well all it evoked from me was a figure or eight sort of motion with my finger near my head thinking it's a bit loopy and I thought strange I don't really see what the attraction is. :wink:

Code: Select all


Global lzx.f=0; 
Global lzy.f=20;
Global lzz.f =22;

If InitSprite() = 0
   End
EndIf
  
If OpenWindow(0, 0, 0, 640, 480, "It's a bit loopy and I thought strange I don't really see what the attraction is", #PB_Window_SystemMenu|#PB_Window_SizeGadget|#PB_Window_ScreenCentered)
  If OpenWindowedScreen(WindowID(0), 0, 0, 640, 480, 1, 0, 0)  
      For a = 0 To 10
      
      CreateSprite(a, 20, 20 )
      
       If StartDrawing(SpriteOutput(a))
        Circle(10, 10, 2 ,RGB(Random(255),Random(255),Random(255)))
        StopDrawing() ; This is required when drawing operations are done. Never forget it!  
    EndIf 
       
    Next
    EndIf
  Repeat
    Repeat
      Event = WindowEvent()
      If Event = #PB_Event_CloseWindow
        End 
      EndIf
    Until Event = 0
    
    FlipBuffers() 
    
    
    ClearScreen(RGB(0, 0, 0))
    StartSpecialFX()
    
    
    If a > 10 
      a=0
    EndIf   
         
    lzx + (0.015*(-10*lzx+10*lzy));
    lzy + (0.015*(28*lzx-lzy-lzx*lzz));
    lzz + (0.015*(-8*lzz/3+lzx*lzy));
   
    x = (lzx*10) + 320;
	  y = (lzz*10) - 20;
	  	  
	   
	  DisplayTranslucentSprite(a, x, y,lzz*3)
         
    
    StopSpecialFX()
      
    
    a+1
    Delay(1)
  
   ForEver

EndIf
edited: sedate version
Last edited by idle on Wed Jul 23, 2008 9:20 pm, edited 4 times in total.
Derek
Addict
Addict
Posts: 2356
Joined: Wed Apr 07, 2004 12:51 am
Location: England

Post by Derek »

@idle, that's very hypnotic. Almost sent me to sleep. :lol:
User avatar
idle
Always Here
Always Here
Posts: 5094
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Post by idle »

Derek wrote:@idle, that's very hypnotic. Almost sent me to sleep. :lol:
try that one lol probably wake you up now!
Derek
Addict
Addict
Posts: 2356
Joined: Wed Apr 07, 2004 12:51 am
Location: England

Post by Derek »

Just got to stick on a Prodigy CD and we have the makings of a rave! :lol: :lol:
User avatar
idle
Always Here
Always Here
Posts: 5094
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Post by idle »

Derek wrote:Just got to stick on a Prodigy CD and we have the makings of a rave! :lol: :lol:
twisted fire starter :lol:
y3an
User
User
Posts: 56
Joined: Sun Mar 09, 2008 6:06 am

Post by y3an »

o.o

When i run without compiler, avast say me "PureBasic_Compilation4.exe" is infected by the virus Win32:KdCrypt [Cryp]

I never had this with another code on Pb..

I have made an analys of my Hd at reboot, no Win32:KdCrypt [Cryp], i restart this without compiler : Win32:KdCrypt [Cryp] again o.o

I have tested some other codes, no Win32:KdCrypt [Cryp] o.o

It leads me to wonder this code looks pretty near of this virus when .exe created.. :?


Someone have the same thing with avast ? It's weard ! :lol:
Just got to stick on a Prodigy CD and we have the makings of a rave! Laughing Laughing
For me it should be more look like a strange cyber-punk thriller focused on an miding spontaneous virus :lol: ( 'seen PI yeasterday 8) )
User avatar
idle
Always Here
Always Here
Posts: 5094
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Post by idle »

maybe the said virus uses a lorenez attractor.
Derek
Addict
Addict
Posts: 2356
Joined: Wed Apr 07, 2004 12:51 am
Location: England

Post by Derek »

There have been a few reports of PB code being mistaken for a virus, do a search for 'Virus Warning' and see what comes up.
y3an
User
User
Posts: 56
Joined: Sun Mar 09, 2008 6:06 am

Post by y3an »

'right, thanks. Idea not came to me search it here =p
User avatar
Rook Zimbabwe
Addict
Addict
Posts: 4326
Joined: Tue Jan 02, 2007 8:16 pm
Location: Cypress TX
Contact:

Post by Rook Zimbabwe »

No Spaz out from Avast when running in compiler... Looks psychadelic!!! I am back in the 60's man... wheres my Lava Lite and my Blacklight poster of Hendrix man?

8)
Binarily speaking... it takes 10 to Tango!!!

Image
http://www.bluemesapc.com/
User avatar
idle
Always Here
Always Here
Posts: 5094
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Post by idle »

pdwyer wrote:Kind of reminds me of Diffie-Hellman key exchange
Yes it would appear to be, it'd be nice to see a working example with an explanation.

I've got a vb implementation lurking in my archives somewhere, so maybe I'll dig it out and try to convert it.
Post Reply