sort of an iterating function

Discussion in 'C Programming' started by Bill Cunningham, May 3, 2012.

  1. the function ?_bcrypt from the posix library has a parameter that
    accepts in values of eights these variables are know as key and data and
    they are both char *. I can think of course of a big iterating function that
    can use for and use it to iterate values of eight but I would like to have a
    simpler way. I know that this doesn't work

    char key[2*8]="The is key to crypt by\n";

    The function only accepts bytes in multiples of 8. This function can be
    found at man cbc_crypt. For the length parameter I use sizeof data. What
    about-

    int i=8;
    for (;i<sizeof data;i(i*2)++)

    Of course I could always type my data and key and manually iterate. Can
    something like this be done?

    cbc_encrypt(work with multiples of 8's,...) ?


    B
     
    Bill Cunningham, May 3, 2012
    #1
    1. Advertisements

  2. Bill Cunningham wrote:
    > the function ?_bcrypt from the posix library has a parameter that
    > accepts in values of eights these variables are know as key and data
    > and they are both char *. I can think of course of a big iterating
    > function that can use for and use it to iterate values of eight but I
    > would like to have a simpler way. I know that this doesn't work
    >
    > char key[2*8]="The is key to crypt by\n";
    >
    > The function only accepts bytes in multiples of 8. This function
    > can be found at man cbc_crypt. For the length parameter I use sizeof
    > data. What about-
    >
    > int i=8;
    > for (;i<sizeof data;i(i*2)++)
    >
    > Of course I could always type my data and key and manually
    > iterate. Can something like this be done?
    >
    > cbc_encrypt(work with multiples of 8's,...) ?
    >
    >
    > B


    I got it I'll work on something.

    THNX
     
    Bill Cunningham, May 3, 2012
    #2
    1. Advertisements

  3. On Wed, 2 May 2012 21:41:24 -0400, "Bill Cunningham"
    <> wrote:

    >Bill Cunningham wrote:
    >> the function ?_bcrypt from the posix library has a parameter that
    >> accepts in values of eights these variables are know as key and data
    >> and they are both char *. I can think of course of a big iterating
    >> function that can use for and use it to iterate values of eight but I
    >> would like to have a simpler way. I know that this doesn't work
    >>
    >> char key[2*8]="The is key to crypt by\n";
    >>
    >> The function only accepts bytes in multiples of 8. This function
    >> can be found at man cbc_crypt. For the length parameter I use sizeof
    >> data. What about-
    >>
    >> int i=8;
    >> for (;i<sizeof data;i(i*2)++)
    >>
    >> Of course I could always type my data and key and manually
    >> iterate. Can something like this be done?
    >>
    >> cbc_encrypt(work with multiples of 8's,...) ?
    >>
    >>
    >> B

    >
    > I got it I'll work on something.


    I don't know what you think you have but

    Your first paragraph doesn't make any sense. You talk of a
    single parameter and then multiple variables. I also don't know what
    a "value of eight" means when referring to char*. What do you mean by
    iterating function. Just for the record, key must be a string of
    exactly eight bytes and data must be a string that is a multiple of 8
    bytes.

    Your array definition contains a constraint violation.

    Your for loop contains at least one syntax error. You would be
    better to use strlen(data) instead of sizeof(data) since data is
    actually a pointer and sizeof will usually be 4 (or 8).

    Since you have not yet said what you want to do, and I'm sure it
    will change in the next message as you hop around from one random
    subject to the another, we have no idea if it can be done or how to do
    it.

    --
    Remove del for email
     
    Barry Schwarz, May 3, 2012
    #3
  4. Barry Schwarz wrote:
    > On Wed, 2 May 2012 21:41:24 -0400, "Bill Cunningham"
    > <> wrote:
    >
    >> Bill Cunningham wrote:
    >>> the function ?_bcrypt from the posix library has a parameter that
    >>> accepts in values of eights these variables are know as key and data
    >>> and they are both char *. I can think of course of a big iterating
    >>> function that can use for and use it to iterate values of eight but
    >>> I would like to have a simpler way. I know that this doesn't work
    >>>
    >>> char key[2*8]="The is key to crypt by\n";
    >>>
    >>> The function only accepts bytes in multiples of 8. This function
    >>> can be found at man cbc_crypt. For the length parameter I use sizeof
    >>> data. What about-
    >>>
    >>> int i=8;
    >>> for (;i<sizeof data;i(i*2)++)
    >>>
    >>> Of course I could always type my data and key and manually
    >>> iterate. Can something like this be done?
    >>>
    >>> cbc_encrypt(work with multiples of 8's,...) ?
    >>>
    >>>
    >>> B

    >>
    >> I got it I'll work on something.

    >
    > I don't know what you think you have but
    >
    > Your first paragraph doesn't make any sense. You talk of a
    > single parameter and then multiple variables. I also don't know what
    > a "value of eight" means when referring to char*. What do you mean by
    > iterating function. Just for the record, key must be a string of
    > exactly eight bytes and data must be a string that is a multiple of 8
    > bytes.
    >
    > Your array definition contains a constraint violation.
    >
    > Your for loop contains at least one syntax error.


    One of the things right now that is giving me some wrestling fits in C
    right now is flow control. Syntax, how to use and when to use switch, if,
    for, while, and so on.

    You would be
    > better to use strlen(data) instead of sizeof(data) since data is
    > actually a pointer and sizeof will usually be 4 (or 8).


    What I meant by values of 8 was multiples of 8.

    Bill
     
    Bill Cunningham, May 3, 2012
    #4
  5. [OT] cbc_crypt was (Re: sort of an iterating function)

    [snipped much]

    ok. Let me try to start at the beginning and make this as simple as
    possible and try to make sense. The first two parameters to cbc_crypt are
    char *. And therefore are 8 bytes in size each. Now this 3rd parameter
    confuses me. It says multiples of 8 must exist. Parameter 1 and 2 should
    each be 8 bytes. How does one make sure that strlen always reports an
    unsigned type of a number that is a multiple of 8? Isn't this what this
    function is wanting? Is a size_t just and unsigned int?

    Bill
     
    Bill Cunningham, May 3, 2012
    #5
  6. Bill Cunningham

    jacob navia Guest

    Le 03/05/12 02:13, Bill Cunningham a écrit :
    > the function ?_bcrypt from the posix library has a parameter that
    > accepts in values of eights these variables are know as key and data and
    > they are both char *.



    Unable to write anything that makes any kind of sense.

    > the function ?_bcrypt from the posix library has a parameter that
    > accepts in values of eights


    FIRST learn the grammar and, after writing, TURN ON YOUR BRAIN and
    READ what you have written. "A PARAMETER THAT ACCEPTS IN VALUES OF
    EIGHTS" makes no sense to anyone but you.

    Then, you go on:

    > these variables are know as key and data and
    > they are both char *.


    Why THESE variables if you have written in the previous sentence that
    it "has A parameter"? Are you speaking about THE parameter (singular)
    or about the "EIGHTS" (whatever those are)?

    Then you continue:

    "these variables are know as key and data"

    "ARE KNOW" maybe "ARE KNOWN"?


    > I can think of course of a big iterating function that
    > can use for and use it to iterate values of eight


    Delirium. "A big iterating function that can use for and
    use it to iterate values of eight" is nonsense. There
    is no meaning behind your sentence.


    > but I would like to have a
    > simpler way. I know that this doesn't work
    >


    Nothing works until you learn to write.

    > char key[2*8]="The is key to crypt by\n";
    >


    There is no need to encrypt your prose Cunningham. It is already
    incomprehensible as it is.

    > The function only accepts bytes in multiples of 8. This function can be
    > found at man cbc_crypt. For the length parameter I use sizeof data. What
    > about-
    >
    > int i=8;
    > for (;i<sizeof data;i(i*2)++)
    >


    Since you did not define what "data" is, nobody can know.


    > Of course I could always type my data and key and manually iterate. Can
    > something like this be done?
    >


    Sure. Just try it.

    > cbc_encrypt(work with multiples of 8's,...) ?


    Your state of mind, as reflected by your prose, is utter confusion.
    You imply in your posts that somehow your medication is responsible but
    that is not the problem. The problem is that you assume that the other
    people are responsible for your nonsense and that you do not have to
    make the effort of RE-READING what you write 2 or 3 times to ensure
    that the grammar is correct and that anyone can understand what you
    write.

    For instance you could have written "bcrypt" instead of ?_bcrypt
    as you wrote. A simple re-reading would have fixed that. But you do
    not make any effort at all to re-read what you write. Just post it.
    The others should make the necessary effort.

    That is a LAZY attitude that leads you to NOTHING. You have never made
    ANY progress, either in C or in English, and before learning C you
    should try to write a single post WITHOUT any error of grammar.

    Make an effort Cunningham. Stop pitying yourself.

    jacob
     
    jacob navia, May 3, 2012
    #6
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Thinker
    Replies:
    4
    Views:
    339
    John Hunter
    May 8, 2004
  2. =?iso-8859-1?Q?=22Orlando_D=F6hring=22?=

    [B,IX] = sort(A,...) - Order for sort()-function

    =?iso-8859-1?Q?=22Orlando_D=F6hring=22?=, May 29, 2007, in forum: Python
    Replies:
    0
    Views:
    367
    =?iso-8859-1?Q?=22Orlando_D=F6hring=22?=
    May 29, 2007
  3. carl
    Replies:
    5
    Views:
    2,674
    James Kanze
    Nov 25, 2009
  4. Navin
    Replies:
    1
    Views:
    852
    Ken Schaefer
    Sep 9, 2003
  5. GIMME
    Replies:
    5
    Views:
    234
    Thomas 'PointedEars' Lahn
    Jul 26, 2004
Loading...

Share This Page