Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - ffausto

Pages: [1]
1
QB64 Discussion / Re: CHR$(26)
« on: April 09, 2018, 03:20:02 pm »
Thank you, FellippeHeitor.
OPEN FOR BINARY and GET works fine.  8)))

Mmmmm ....
LET IT =  BE ?
ALL RIGHT! Beatles forever!!

2
QB64 Discussion / Re: CHR$(26)
« on: April 08, 2018, 03:44:57 pm »
No problem. One time pad is known since 1915~1920: is very easy, fast and NSA proof.
Here is the heart of the program. There are two input files, the readable one and the key, and an output file: the coded one.

  OPEN "I", #1, FILEIN$:LFILEIN# = LOF(1)
  OPEN "I", #2, FILECHIAVE$:LFILECHIAVE# = LOF(2)

IF LFILEIN# < LFILECHIAVE# THEN CONTA# = LFILEIN# ELSE END

  OPEN "O", #3, FILEOUT$
   
     FOR NCARATTERE# = 1 TO CONTA#
       CARATTEREIN$ = INPUT$(1, #1)
       CARATTERECHIAVE$ = INPUT$(1, #2)
       NUMEROIN% = ASC(CARATTEREIN$)
       NUMEROCIFRA% = ASC(CARATTERECHIAVE$)
       NUMEROCIFRATO% = NUMEROIN% XOR NUMEROCIFRA%
       CARATTERECIFRATO$ = CHR$(NUMEROCIFRATO%)
       PRINT #3, CARATTERECIFRATO$;
     NEXT
     
  CLOSE

Decoding uses the same program, with the the coded file as input.
Coding/decodig statement is the one with XOR inside.
My problem is the coded file that may include EVERY byte from 0 to 255, I can "clean" the key but NOT the the coded file.

Tha attachment is a BINARY file with a short example, open with an Hex editor, NOT with a text editor.

3
QB64 Discussion / CHR$(26)
« on: April 08, 2018, 07:57:58 am »
I am writing a small  cryptography program (one time pad) where I need to read byte by byte a sequential file with random numbers (created separately - see Random.org).
I am having a problem with CHR(26) (hex 1A) read as EOF. When CHR(26) is reached the reading of the random number file ends.

If I remove the CHR(26) everything works fine using the statements:
OPEN FOR INPUT
followed by
randomnumber$ = INPUT$(1, #1):randomnumber% = ASC(randomnumber$)

I also tried with
OPEN FOR BINARY
followed by
GET #1, , randomnumber%%
but, from that terrible 26 on i have only got zeroes.

Does anyone know a way around this problem?

P.S.: I tried to register on "official" QB64 forum but I couldn't, neither from Windows nor from Linux nor from Android. And I haven't found either  an e-mail address to ask for help. Does anyone know  what to do?

Pages: [1]