Thread: Wrapper functions for encryption

  1. #1
    Registered User
    Join Date
    Apr 2017
    Posts
    11

    Wrapper functions for encryption

    I have executed the blowfish algorithm and my output for string is
    Code:
    Encrypting string(12): technologies
    (0) ENC_DUMP: t->0x9BB46254476C, e->0x1C458C4D7E5D5
    (2) ENC_DUMP: c->0x1733846EEDDF5, h->0x122165497E762
    (4) ENC_DUMP: n->0x1CECA6B5E3D0F, o->0x10F4CC1EAAA7B
    (6) ENC_DUMP: l->0x1A0D58AB2FF79, o->0x107FF53CA917B
    (8) ENC_DUMP: g->0xEB7B0435136F, i->0x137C5A85CC93B
    (10) ENC_DUMP: e->0x32B9EAADF385, s->0xC4AD7059D8DB
    Decrypted string: technologies
    but when i use the password how can i do it.I read the article here
    How to use the Blowfish algo?

    Here they said that for using of password we have to create the wrapper.I don't know what it is can anyone can have the idea of how to create the wrapper for password and how to use it.

    I need the crypt_blowfish model encryption.
    Last edited by Naveen11@; 04-23-2017 at 11:00 PM.

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    Referring to your previous thread.
    Format specifiers error

    > /* you could replace this with a new key of course */
    > Blowfish_Init (&ctx, (unsigned char*)"TESTKEY", 7);

    > Here they said that for using of password we have to create the wrapper.
    Well if you made the password argv[2] in your program, you would have your wrapper.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User
    Join Date
    Apr 2017
    Posts
    11
    > /* you could replace this with a new key of course */
    > Blowfish_Init (&ctx, (unsigned char*)"TESTKEY", 7);

    In these is there we can use any range of length or their is any restriction in their range and also we can use string only or use any special characters.
    Blowfish_Init (&ctx, (unsigned char*)"Kn0wed&e1s^0wER", 7);

    > Here they said that for using of password we have to create the wrapper.
    Well if you made the password argv[2] in your program, you would have your wrapper.[/QUOTE]

    When i change the argv[2] as you said i end up with an error like.can you explain me fully.
    Code:
    (gdb) run naveenraj
    Starting program: /home/niche-0043/Downloads/bfsh-sch/a.out naveenraj
    Encrypting string(9): (null)
    
    Program received signal SIGSEGV, Segmentation fault.
    0x0000000000400d00 in main (argc=2, argv=0x7fffffffdeb8) at blow.c:528
    528            enc[i] = str[i];
    Last edited by Naveen11@; 04-24-2017 at 01:22 AM.

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    > (gdb) run naveenraj
    One presumes that one is smart enough to pass TWO arguments to a program when TWO arguments are expected.

    Or at least change the number of expected arguments check at the beginning of the program to defend against user error.

    > Blowfish_Init (&ctx, (unsigned char*)"Kn0wed&e1s^0wER", 7);
    What do you think the 7 actually represented in the first example?
    - The number of days in a week.
    - The number of faces on a cube, +1
    - The length of the edge of a chess board, -1
    - The length of the key string.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  5. #5
    Registered User
    Join Date
    Apr 2017
    Posts
    11
    Quote Originally Posted by Salem View Post
    > (gdb) run naveenraj
    One presumes that one is smart enough to pass TWO arguments to a program when TWO arguments are expected.

    Or at least change the number of expected arguments check at the beginning of the program to defend against user error.

    > Blowfish_Init (&ctx, (unsigned char*)"Kn0wed&e1s^0wER", 7);
    What do you think the 7 actually represented in the first example?
    - The number of days in a week.
    - The number of faces on a cube, +1
    - The length of the edge of a chess board, -1
    - The length of the key string.

    Actually i forgot to change the key length
    Code:
    Blowfish_Init (&ctx, (unsigned char*)"Kn0wed&e1s^0wER", 15);
    Code:
    Reading symbols from ./a.out...done.
    (gdb) run technology
    Starting program: /home/niche-0043/Downloads/bfsh-sch/a.out technology
    Encrypting string(10): (null)
    
    Program received signal SIGSEGV, Segmentation fault.
    0x0000000000400d00 in main (argc=2, argv=0x7fffffffdeb8) at blow.c:528
    528            enc[i] = str[i];
    (gdb)

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Is there a C wrapper for Qt?
    By hikerFreak in forum C Programming
    Replies: 3
    Last Post: 12-07-2016, 04:06 PM
  2. Replies: 6
    Last Post: 03-08-2012, 05:37 PM
  3. exception handling wrapper functions?
    By m37h0d in forum C++ Programming
    Replies: 17
    Last Post: 06-10-2008, 02:56 PM
  4. Writing a Wrapper
    By Rixeno in forum C++ Programming
    Replies: 6
    Last Post: 06-04-2008, 01:36 PM
  5. DLL Wrapper
    By vampirekiss in forum C Programming
    Replies: 4
    Last Post: 01-08-2008, 10:24 AM

Tags for this Thread