On 05/21/2015 03:56 AM, Daniel P. Berrange wrote:
> +static uint8_t *qcrypto_cipher_munge_des_rfb_key(const uint8_t *key,
> +                                                 size_t nkey)
> +{
> +    uint8_t *ret = g_new0(uint8_t, nkey);
> +    size_t i;
> +    for (i = 0; i < nkey; i++) {
> +        uint8_t r = key[i];
> +        r = (r & 0xf0)>>4 | (r & 0x0f)<<4;
> +        r = (r & 0xcc)>>2 | (r & 0x33)<<2;
> +        r = (r & 0xaa)>>1 | (r & 0x55)<<1;
> +        ret[i] = r;
> +    }
> +    return ret;
> +}
> +

Surely you can share this between the gcrypt and nettle files and not duplicate
it...


r~

Reply via email to