Author Topic: Vernam's implementation  (Read 1891 times)

0 Members and 1 Guest are viewing this topic.

Offline EpicOut

  • /dev/null
  • *
  • Posts: 5
  • Cookies: 0
    • View Profile
Vernam's implementation
« on: November 24, 2014, 02:45:51 pm »
Hi today i'm sharing  with you my vernam's implementation i made in C, i hope you will enjoy it, if you have any questions about the code or whatever related, feel free to ask, go on :-)


http://pastebin.com/iwLuetvU
« Last Edit: November 24, 2014, 02:51:00 pm by EpicOut »

Offline immortalghost

  • Serf
  • *
  • Posts: 24
  • Cookies: 1
    • View Profile
Re: Vernam's implementation
« Reply #1 on: November 24, 2014, 02:55:08 pm »
It looks cut off at the bottom

Offline EpicOut

  • /dev/null
  • *
  • Posts: 5
  • Cookies: 0
    • View Profile
Re: Vernam's implementation
« Reply #2 on: November 24, 2014, 02:58:21 pm »
it isn't :p

Offline immortalghost

  • Serf
  • *
  • Posts: 24
  • Cookies: 1
    • View Profile
Re: Vernam's implementation
« Reply #3 on: November 24, 2014, 03:01:21 pm »
it isn't :p
then you forgot to close main, or I'm missing something. Care to explain?

Offline EpicOut

  • /dev/null
  • *
  • Posts: 5
  • Cookies: 0
    • View Profile
Re: Vernam's implementation
« Reply #4 on: November 24, 2014, 03:57:49 pm »
Eaxtly i forgot to close my main but otherwise this is not cut off ^^
« Last Edit: November 24, 2014, 03:59:20 pm by EpicOut »

Offline ArkPhaze

  • Peasant
  • *
  • Posts: 136
  • Cookies: 20
  • null terminated
    • View Profile
Re: Vernam's implementation
« Reply #5 on: December 20, 2014, 02:45:30 am »
Eaxtly i forgot to close my main but otherwise this is not cut off ^^

That doesn't make any sense. You've just proved that it is cut off. The source is not complete, and that's the fact. You missed a closing bracket -- it's cut off.

You shouldn't be seeding the rng from a function which sets the random values to a pre-allocated buffer like that. You've defeated the whole point of 'randomness' if you intend for this function to be called multiple times (and it looks like it *should* semantically be set up to do that).

In C you aren't required to cast the return from functions like malloc() which return void*.
« Last Edit: December 20, 2014, 02:55:37 am by ArkPhaze »
sig=: ArkPhaze

[ J/ASM/.NET/C/C++ - Software Engineer ]