Method: Magick::Image#signature

Defined in:
ext/RMagick/rmimage.cpp

#signatureString?

Compute a message digest from an image pixel stream with an implementation of the NIST SHA-256 Message Digest algorithm.

Returns:

  • (String, nil)

    the message digest



13254
13255
13256
13257
13258
13259
13260
13261
13262
13263
13264
13265
13266
13267
13268
13269
13270
13271
13272
13273
13274
13275
13276
13277
13278
13279
13280
13281
13282
# File 'ext/RMagick/rmimage.cpp', line 13254

VALUE
Image_signature(VALUE self)
{
    Image *image;
    const char *signature;
#if defined(IMAGEMAGICK_7)
    ExceptionInfo *exception;
#endif

    image = rm_check_destroyed(self);

#if defined(IMAGEMAGICK_7)
    exception = AcquireExceptionInfo();
    GVL_STRUCT_TYPE(SignatureImage) args = { image, exception };
    CALL_FUNC_WITHOUT_GVL(GVL_FUNC(SignatureImage), &args);
    CHECK_EXCEPTION();
    DestroyExceptionInfo(exception);
#else
    GVL_STRUCT_TYPE(SignatureImage) args = { image };
    CALL_FUNC_WITHOUT_GVL(GVL_FUNC(SignatureImage), &args);
    rm_check_image_exception(image, RetainOnError);
#endif
    signature = rm_get_property(image, "signature");
    if (!signature)
    {
        return Qnil;
    }
    return rb_str_new(signature, 64);
}