X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?p=chiark-tcl.git;a=blobdiff_plain;f=base%2Fhook.c;h=a9d0316f0c90089cce1f1383caa5030b30dfc8f0;hp=937295842b8045c3b765e45084f7a32c2d0ac058;hb=eddc638bb3b8e716879edf149b2a6e37c8bc9e8d;hpb=fa11284b9469c1c79af7f8f129da934c1ebcf594 diff --git a/base/hook.c b/base/hook.c index 9372958..a9d0316 100644 --- a/base/hook.c +++ b/base/hook.c @@ -255,6 +255,22 @@ int do_hbytes_repeat(ClientData cd, Tcl_Interp *ip, return TCL_OK; } +int do_hbytes_xor(ClientData cd, Tcl_Interp *ip, + HBytes_Var v, HBytes_Value d) { + int l; + Byte *dest; + const Byte *source; + + l= hbytes_len(v.hb); + if (hbytes_len(&d) != l) return + staticerr(ip, "hbytes xor lengths do not match", "HBYTES LENGTH MISMATCH"); + + dest= hbytes_data(v.hb); + source= hbytes_data(&d); + memxor(dest,source,l); + return TCL_OK; +} + int do_hbytes_zeroes(ClientData cd, Tcl_Interp *ip, int length, HBytes_Value *result) { Byte *space;